how to get the number of seconds passed since 1970 for a date value?

前端 未结 2 461
执念已碎
执念已碎 2020-12-16 09:15

I have to an android application in which I need to convert the current date to the number of seconds passed since 1970.

What I am doing currently i

2条回答
  •  [愿得一人]
    2020-12-16 09:37

    System.currentTimeMillis() gives you the number of milliseconds since the Unix epoch (January 1, 1970 00:00:00 UTC).

    Divide it by 1000 to get the number of seconds.

提交回复
热议问题