Skip to content

Instantly share code, notes, and snippets.

@kitsunde
Created October 28, 2012 17: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 kitsunde/3969154 to your computer and use it in GitHub Desktop.
Save kitsunde/3969154 to your computer and use it in GitHub Desktop.
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = function() {
function pad(n) { return n < 10 ? '0' + n : n }
return this.getUTCFullYear() + '-'
+ pad(this.getUTCMonth() + 1) + '-'
+ pad(this.getUTCDate()) + 'T'
+ pad(this.getUTCHours()) + ':'
+ pad(this.getUTCMinutes()) + ':'
+ pad(this.getUTCSeconds()) + 'Z';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment