有時前后端交互需要傳遞時間戳。獲取時間戳的方法如下:
console.log( Date.parse(new Date()) ) // 1574318285000 精確到秒 console.log( (new Date()).valueOf() ) // 1574318285290 精確到毫秒 console.log( new Date().getTime()) // 1574318285290 精確到毫秒
有時前后端交互需要傳遞時間戳。獲取時間戳的方法如下:
console.log( Date.parse(new Date()) ) // 1574318285000 精確到秒 console.log( (new Date()).valueOf() ) // 1574318285290 精確到毫秒 console.log( new Date().getTime()) // 1574318285290 精確到毫秒
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。