Created
September 29, 2012 21:16
-
-
Save allensarkisyan/3805208 to your computer and use it in GitHub Desktop.
ISO 8601 timestamp for facebook open graph implementations, omitted seconds
This file contains hidden or 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
// ISO 8601 Date Prototype - Usage example: (new Date).ISO8601(); | |
Date.prototype.ISO8601 = function() { | |
function wrap(n) { return (n < 10 ? '0' + n : n) } | |
var dt = this; | |
return dt.getUTCFullYear() + '-' + wrap(dt.getUTCMonth() + 1) + '-' + wrap(dt.getUTCDate()) + 'T' + wrap(dt.getUTCHours()) + ':' + wrap(dt.getUTCMinutes()); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment