javascript - Get String in YYYYMMDD format from JS date object? - Stack Overflow Altered piece of code...

Please Visit: http://ift.tt/1ajReyV



javascript - Get String in YYYYMMDD format from JS date object? - Stack Overflow



Altered piece of code I often use:

Date.prototype.yyyymmdd = function() {

var yyyy = this.getFullYear().toString();

var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based

var dd = this.getDate().toString();

return yyyy + (mm[1]?mm:"0"+mm[0]) + (dd[1]?dd:"0"+dd[0]); // padding

};

d = new Date();

d.yyyymmdd();

http://ift.tt/1oaCQWx

http://ift.tt/1qp2mo3



javascript - Get String in YYYYMMDD format from JS date object? - Stack Overflow







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1oaCQWA

via LifeLong Community

No comments:

Post a Comment