1. 程式人生 > >js獲取當前時間戳,仿PHP函數模式

js獲取當前時間戳,仿PHP函數模式

time() HP bsp col 獲取時間 bstr time php span

函數:

/**
 * 獲取時間戳函數
 * 仿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());

js獲取當前時間戳,仿PHP函數模式