Node.js examples for Date:Date Format
Format date as rfc 3339
function f(n) {/*from ww w.java 2 s . c om*/ return n < 10 ? '0' + n : n; } Date.prototype.rfc3339 = function() { return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; };