zoukankan      html  css  js  c++  java
  • JS获取当前时间戳的方法

    //方法一
    var timestamp = (new Date()).getTime();
    console.log(timestamp); //1495302061441

    //方法二
    var timestamp2 = (new Date()).valueOf();
    console.log(timestamp2); //1495302061447

    //方法三
    var timestamp3 = Date.parse(new Date());
    console.log(timestamp3);//1495302061000

    第一种和第二种是获取了当前毫秒的时间戳
    最后一种获取的时间戳是把毫秒改成000显示

  • 相关阅读:
    20201107
    20201024
    20201020
    20200331
    20200330
    20200320
    20200319
    20200310
    20200221
    20190926
  • 原文地址:https://www.cnblogs.com/fozero/p/6959946.html
Copyright © 2011-2022 走看看