Here's the scenario:
If I pass an int
to Date as below, the output would be Thu Jan 22 20:56:36 CST 1970
:
System.out.println(new Date(1393430400*1000));
When I pass a long
, the output is just what I intend for: Thu Feb 27 00:00:00 CST 2014
System.out.println(new Date((long)1393430400*1000));
I've checked the method which the new Date(long l)
invoked. It's just the same one:
public Date(long date) {
fastTime = date;
}
Could anyone give me some explanations on this problem? Thanks a lot!