亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - How to quickly convert CST time into timestamp
女神的閨蜜愛(ài)上我
女神的閨蜜愛(ài)上我 2017-06-26 10:53:32
0
1
1087
Thu Jun 15 2017 14:35:48 GMT+0800 (CST)

For example, for a time like this, I am currently using the VUE element plug-in. I don’t know why the time comes out in this format. Is there a simpler conversion method?

女神的閨蜜愛(ài)上我
女神的閨蜜愛(ài)上我

reply all(1)
學(xué)習(xí)ing

new Date('Thu Jun 15 2017 14:35:48 GMT+0800 (CST)').getTime()
Attach a function

function parseTime (timeStamp, format) {
    var date = new Date(timeStamp);
    var o = {
        'M+' : date.getMonth() + 1, //month
        'D+' : date.getDate(), //day
        'h+' : date.getHours(), //hour
        'm+' : date.getMinutes(), //minute
        's+' : date.getSeconds(), //second
        'S' : date.getMilliseconds() //millisecond
    }

    if(/(Y+)/.test(format)) {
        format = format.replace(RegExp.,
            (date.getFullYear() + '').substr(4 - RegExp..length));
    }

    for(var k in o) {
        if (new RegExp('('+ k +')').test(format)) {
            format = format.replace(RegExp.,
                RegExp..length == 1 ? o[k] : ('00'+ o[k]).substr((''+ o[k]).length));
        }
    }
    return format;
}
// usage
parseTime(new Date.getTime(), 'hh:mm')
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template