js把日期字符串转换成时间戳

xiaoxiao2021-02-28  57

dateStr格式为“ 2014-05-08 00:22:11 ” function get_unix_time(dateStr) {       var newstr = dateStr.replace(/-/g,'/');        var date =   new Date(newstr);        var time_str = date.getTime().toString();       return time_str.substr(0, 10);

}

转载地址:http://blog.sina.com.cn/s/blog_97688f8e0101wmha.html

转载请注明原文地址: https://www.6miu.com/read-77687.html

最新回复(0)