//格式化时间
function time_format(time) {
     return new Date(parseInt(time) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');   
}
time_format(20158645);
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);
}
get_unix_time("1970-8-22 15:37");

 

posted on 2017-06-26 16:59  晨曦年华  阅读(154)  评论(0编辑  收藏  举报