Get current date/time in seconds

前端 未结 13 1592
失恋的感觉
失恋的感觉 2020-11-29 17:14

How do I get the current date/time in seconds in Javascript?

相关标签:
13条回答
  • 2020-11-29 17:57

    Better short cuts:

    +new Date # Milliseconds since Linux epoch
    +new Date / 1000 # Seconds since Linux epoch
    Math.round(+new Date / 1000) #Seconds without decimals since Linux epoch
    
    0 讨论(0)
提交回复
热议问题