JavaScript常用的获取时间戳的方法

学习笔记。JavaScript获取时间戳

<script>  
    /*
        学习功能:掌握JavaScript生成时间戳的几种常用方法
        author: lisa于2018-6-21
    */
  
    //显示当前毫秒的时间戳,13位。例:1529549899973    
    var timestamp = new Date().getTime();  
    var timestamp = (new Date()).valueOf();  
  
    //毫秒为000显示,13位。例:1529549924000  
    var timestamp = Date.parse(new Date());   
      
    alert(timestamp)  
</script> 


猜你喜欢

转载自blog.csdn.net/weixin_42322501/article/details/80757407