Last active
October 11, 2015 13:48
-
-
Save tored/3868138 to your computer and use it in GitHub Desktop.
isoDateString
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isoDateString(d) { | |
function pad(n) { | |
return n < 10 ? '0' + n : n; | |
} | |
return d.getUTCFullYear() + '-' + | |
pad(d.getUTCMonth()+1) + '-' + | |
pad(d.getUTCDate()) + 'T' + | |
pad(d.getUTCHours()) + ':' + | |
pad(d.getUTCMinutes()) + ':' + | |
pad(d.getUTCSeconds()) + 'Z'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment