js将字符串转化为日期时间格式

版权声明:虽然我很菜,但我在努力! https://blog.csdn.net/qq_39331713/article/details/84999797
function timeTransform(ele) {
    var time=$(ele).val();
    var d = new Date(time);
    var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes()
    return times;
}

猜你喜欢

转载自blog.csdn.net/qq_39331713/article/details/84999797