서열화 날짜(yyyy-MM-dd hh:mm:ss)

1574 단어
var getDateFormat = function() {
    var _date = new Date(); // Date 
    var _complete = function(value) { // 
        return(value > 9) ? value : '0' + value;
    };
    var year, month, day, hour, minute, second;
    year = _date.getFullYear();
    month = _complete(_date.getMonth() + 1); //month (0-11)
    day = _complete(_date.getDate());
    hour = _complete(_date.getHours());
    minute = _complete(_date.getMinutes());
    second = _complete(_date.getSeconds());
    return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
};

 
다음으로 전송:https://www.cnblogs.com/xiaoyucoding/p/6401255.html

좋은 웹페이지 즐겨찾기