Skip to content

Instantly share code, notes, and snippets.

@tored
Last active October 11, 2015 13:48
Show Gist options
  • Save tored/3868138 to your computer and use it in GitHub Desktop.
Save tored/3868138 to your computer and use it in GitHub Desktop.
isoDateString
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