码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2018-04-26 16:57:16      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:time()   bsp   this   func   函数   return   int   时间   turn   

函数:

/**
 * 获取时间戳函数
 * 仿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函数模式

标签:time()   bsp   this   func   函数   return   int   时间   turn   

原文地址:https://www.cnblogs.com/phpyangbo/p/8952853.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!