java时间戳

代码

long epoch = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse("01/01/1970 01:00:00").getTime() / 1000;
String date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new Date (epoch*1000));

ref

https://stackoverflow.com/a/43425260/5824202

posted @ 2022-07-07 22:56  talentzemin  阅读(123)  评论(0编辑  收藏  举报