Skip to content

Instantly share code, notes, and snippets.

@sankarseran
Created June 7, 2018 06:02
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 sankarseran/952e7c90f763b5e5446825f9e8daf0cb to your computer and use it in GitHub Desktop.
Save sankarseran/952e7c90f763b5e5446825f9e8daf0cb to your computer and use it in GitHub Desktop.
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