How do I create a Unix timestamp on Android?

怎甘沉沦 提交于 2019-12-03 06:13:28

问题


How do I create a Unix timestamp on Android?

I want to create a URL post request with a Unix timestamp on the end of the url.


回答1:


 long unixTime = System.currentTimeMillis() / 1000L;



回答2:


It's quite simple:

long timestamp = Calendar.getInstance().getTime() / 1000;


来源:https://stackoverflow.com/questions/10177552/how-do-i-create-a-unix-timestamp-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!