Skip to content

Instantly share code, notes, and snippets.

@L8D
Last active December 16, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save L8D/5498414 to your computer and use it in GitHub Desktop.
Save L8D/5498414 to your computer and use it in GitHub Desktop.
Snippet of a javascript date formatter.
return d.getUTCFullYear()
+ '-' + zeroFill(d.getUTCMonth() + 1, 2)
+ '-' + zeroFill(d.getUTCDate(), 2)
+ 'T' + zeroFill(d.getUTCHours(), 2)
+ ':' + zeroFill(d.getUTCMinutes(), 2)
+ ':' + zeroFill(d.getUTCSeconds(), 2)
+ '.' + zeroFill(d.getUTCMilliseconds() * 1000, 6)
+ 'Z';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment