js获取当前时间戳,仿PHP函数模式

函数:

/**
 * 获取时间戳函数
 * 仿PHP函数模式
*/
function time(){
    var this_time    =    Date.parse(new Date());
        this_time    =    ''+this_time;
        this_time    =    this_time.substring(0,10);
        this_time    =    parseInt(this_time);
    return this_time;
}

用法:

alert(time());

 

posted on 2018-04-26 15:43  鱼塘总裁  阅读(483)  评论(0编辑  收藏  举报