Node.js examples for Date:Date Format
Set date value from yyyymmdd
Date.prototype.fromString = function (str) { // Parses yyyymmdd if (!str || str.length != 8) { return null; }/*from w w w .ja v a 2 s . com*/ var y = parseInt(str.substr(0, 4), 10) var m = parseInt(str.substr(4, 2), 10) var d = parseInt(str.substr(6, 2), 10) this.setFullYear(y); this.setDate(1); this.setMonth(m-1); this.setDate(d); return this; }