与java时间戳怪异 - 简单测试失败?

问题描述:

这里是我的测试:与java时间戳怪异 - 简单测试失败?

long stamp = 1471314737L;//unix timestamp for 16 Aug 2016... 
Timestamp test = new Timestamp(stamp); 
System.out.println("test = " + test.toString()); 

1970年1月17日16:41:54.737

什么了吗?

+1

尝试乘以时间戳x1000,因为您的时间戳记以秒为单位,并且新的时间戳记(timestamp)构造函数需要毫秒数 – msumera

+0

正确,谢谢... – toilinginobscurity

Timestamp(long time)使用 毫秒的时间值构造Timestamp对象。

https://docs.oracle.com/javase/7/docs/api/java/sql/Timestamp.html

尝试通过1000的时间戳乘以?