jQuery


jQuery UI change default date format

$('.js-datepicker').datepicker({
    dateFormat: "yy-mm-dd", changeMonth: true, changeYear: true
});
Date.prototype.yyyymm = function () {
    var yyyy = this.getFullYear().toString();
    var mm = (this.getMonth() + 1).toString(); // getMonth() is zero-based
    return yyyy + '-' + (mm[1] ? mm : "0" + mm[0]); // padding
};

 

 


Published: 2016-08-29