JavaScript取得标准的系统时间

   
function getNowFormatDate() {
        //获取当前的日期时间 格式“yyyy-MM-dd HH:MM”
        var date = new Date();
        var seperator1 = "-";
        var seperator2 = ":";
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }

        var hour = date.getHours();
        var minute = date.getMinutes();
        if (parseInt(hour) < 10)
            hour = "0" + hour;
        if (parseInt(minute) < 10)
            minute = "0" + minute;
        var curT = hour + ':' + minute;

        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                + " " + curT
        // + seperator2 + date.getSeconds();
        return currentdate;
    }


JavaScript取得标准的系统时间  2016-07-05 12:20

你可能感兴趣的:(JQuery)