Time conversion from seconds to date issue

后端 未结 4 1210
慢半拍i
慢半拍i 2021-01-29 09:23

I have the following Long variable holding epoch value in seconds, which I\'m trying to convert into a Date.

val seconds = 1341855763000         


        
4条回答
  •  旧时难觅i
    2021-01-29 10:12

    Your value : 1341855763000 is not in seconds, it is in milliseconds. The current timestamp is : new Date().getTime() => 1598612990351 Same number of digits than : 1341855763000

    If you multiply 1341855763000 by 1000 (as you say), it gives the year : 44491 after JC :D Have a good day

提交回复
热议问题