Here you can find the source of toShortDateString()
String.prototype.toShortDateString = function() { var date = new Date(this); return date.toDateString().substr(4); }; module.exports = {// w w w . j a v a 2s . c om toShortDateString: function(dateString) { var date = new Date(dateString); return date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear(); }, sayHello: function() { return "Hello"; } }
Date.prototype.toShortDateString = function () { var tempStr = ''; var dayOfTheMonth = this.getDate(); var month = this.getMonth(); var year = this.getFullYear(); tempStr += dayOfTheMonth.padWithDigits(2) + '-' + month.padWithDigits(2) + '-' + year.padWithDigits(4); return tempStr; };
Date.prototype.toShortDateString = function() { return this.getFullYear() + "/" + (this.getMonth() + 1) + "/" + this.getDate(); };