js把日期字符串转换成时间戳
2017-07-11 18:23
316 查看
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
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
相关文章推荐
- jq、js实现字符串转换日期计算时间差
- js获取一天的开始时间和结束时间和日期与字符串、数值之间的转换
- 【js Date】时间字符串、时间戳转换成今天,明天,本月等文字日期
- JS中字符串转换为日期对象的方法JS中如何计算时间,如何比较时间
- js 时间戳 与 字符串 和 日期格式 的转换
- js 日期转字符串 时间类型转换
- js获取时间和日期,字符串和时间戳之间的转换
- js中使用eval()方法将字符串转换成日期格式、并获取指定时间的日期
- JS日期格式字符串转换为日期毫秒数和时间毫秒数转换为日期
- JS获取当前时间 时间戳和日期字符串相互转换
- js把日期字符串转换成时间戳
- js把日期字符串转换成时间戳
- js把日期字符串转换成时间戳
- js把日期字符串转换成时间戳
- js转换时间戳与日期字符串
- js 字符串与数值相互转换,以及时间戳转换成日期形式字符串方法
- js时间戳和日期字符串相互转换
- js 时间戳和日期字符串相互转换
- js日期字符串(年月日)与时间戳的转换
- js动态获取当前系统时间+js字符串转换为date日期对象