long timeStampSec = System.currentTimeMillis()/1000;
String timestamp = String.format("%010d", timeStampSec);
如 2017-02-27 15:48:27 的13位时间戳为:1488181707000
System.out.println(String.format("%010d",1488181707000L/1000));
输出:1488181707
转换结果:
long timeStampSec = System.currentTimeMillis()/1000;
String timestamp = String.format("%010d", timeStampSec);
如 2017-02-27 15:48:27 的13位时间戳为:1488181707000
System.out.println(String.format("%010d",1488181707000L/1000));
输出:1488181707
转换结果:
© 著作权归作者所有