$(function(){
    //可以这样调用
    var startDate = new Date("2019-04-30 16:30:30").Format("yyyy-MM-dd");
    //也可以这样调用
    var endDate = new Date().Format("yyyy-MM-dd HH:mm:ss");
});
//兼容性处理,可兼容ie,firefox,谷歌。在时间日期上基于'/'格式的日期字符串,才是被各个浏览器所广泛支持的。
var startDate1 = new Date("2019-04-30 16:30:30".toString().replace(/-/g,"/")).Format("yyyy-MM-dd");


//jquery将日期转换成指定格式的字符串
Date.prototype.Format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "H+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}

jquery格式化日期yyyy-mm-dd jquery 日期格式化为yyyy-mm-dd_日期转换

jquery格式化日期yyyy-mm-dd jquery 日期格式化为yyyy-mm-dd_jquery_02