js 时间日期转换时间戳格式

function get_unix_time(dateStr)
{
	// dateStr="2019-09-06 21:49:30";
	var newstr = dateStr.replace(/-/g,'/');
	var date = new Date(newstr);
	var time_str = date.getTime().toString();
	return time_str.substr(0, 10);
	// alert(time_str.substr(0, 10));
}

  

posted @ 2019-08-08 11:04  x_hui  阅读(276)  评论(0编辑  收藏  举报