Javascript Date today()

Description

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*/

Javascript Date today()

// For todays date;
Date.prototype.today = function () { 
    return (((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ ((this.getDate() < 10)?"0":"") + this.getDate() +"/"+ this.getFullYear();
}

Javascript Date today()

Date.prototype.today = function() {
 return ((this.getDate() < 10) ? "0" : "") + this.getDate() + "/"
   + (((this.getMonth() + 1) < 10) ? "0" : "") + (this.getMonth() + 1)
   + "/" + this.getFullYear();
};

Javascript Date today()

// For todays date;
Date.prototype.today = function () { 
    return ((this.getDate() < 10)?"0":"") + this.getDate() +"/"+(((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ this.getFullYear();
}

Javascript Date today()

'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()
}



PreviousNext

Related