I like to extend the JavaScript Date object a little bit, to provide me with the one true date format, aka: ISO8601.
Date.prototype.toISO8601()
{
var r = this.getFullYear()
+ '-' + ('0' + (this.getMonth() + 1)).substr(-2)
+ '-' + ('0' + this.getDate()).substr(-2)
+ 'T' + ('0' + this.getHours()).substr(-2)
+ ':' + ('0' + this.getMinutes()).substr(-2)
+ ':' + ('0' + this.getSeconds()).substr(-2)
// Timezone shit
// var tz =
}
Date.prototype.toISO8601UTC()
{
var r = this.getUTCFullYear()
+ '-' + ('0' + (this.getUTCMonth() + 1)).substr(-2)
+ '-' + ('0' + this.getUTCDate()).substr(-2)
+ 'T' + ('0' + this.getUTCHours()).substr(-2)
+ ':' + ('0' + this.getUTCMinutes()).substr(-2)
+ ':' + ('0' + this.getUTCSeconds()).substr(-2)
+ 'Z';
return r;
}