Javascript Date today()
var exports = module.exports = {}; Date.prototype.today = function () { return ((this.getDate() < 10)?"0":"") + this.getDate() +"/"+(((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ this.getFullYear(); } var newDate = new Date(); console.log(newDate.today());/* w ww . j ava2 s . c o m*/
// For todays date; Date.prototype.today = function () { return (((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ ((this.getDate() < 10)?"0":"") + this.getDate() +"/"+ this.getFullYear(); }
Date.prototype.today = function() { return ((this.getDate() < 10) ? "0" : "") + this.getDate() + "/" + (((this.getMonth() + 1) < 10) ? "0" : "") + (this.getMonth() + 1) + "/" + this.getFullYear(); };
// For todays date; Date.prototype.today = function () { return ((this.getDate() < 10)?"0":"") + this.getDate() +"/"+(((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ this.getFullYear(); }
'use strict'// w w w . ja v a 2 s . co m Date.prototype.today = function () { return (this.getDate() < 10 ? '0' : '') + this.getDate() + '.' + (this.getMonth() + 1 < 10 ? '0' : '') + (this.getMonth() + 1) + '.' + this.getFullYear() }