Javascript Date ymd()

Description

Javascript Date ymd()


// Copy remote file (ex. Redis DB-dump.rdb) to local for backup

Date.prototype.ymd = function() {
    var mm = this.getMonth() + 1;
    var dd = this.getDate();

    return [this.getFullYear().toString().substr(2,2),
            (mm>9 ? '' : '0') + mm,
            (dd>9 ? '' : '0') + dd
           ].join('');

};



PreviousNext

Related