javascript中字符串转时间戳
字符串转日期对象
<script>
function get_unix_time(dateStr)
{
var newstr = dateStr.replace(/-/g,'/');
var date = new Date(newstr);
var time_str = date.getTime().toString();
return time_str/1000;
}
console.log("1399479731")
console.log(get_unix_time("2014-12-31"))
console.log(get_unix_time("2015-02-08 00:22:11"))
</script>

浙公网安备 33010602011771号