new Date(long) gives different results

Viewed 4600

When I run this code:

System.out.println( "XXX date=" + new Date( 1311781583373L ) );

I get this result in Eclipse's JUnit runner:

XXX date=Wed Jul 27 16:46:23 GMT+01:00 2011

and this result in Maven from the command line:

XXX date=Wed Jul 27 17:46:23 CEST 2011

As you can see, the hour is different.

(same computer, same Java version, maybe 30s apart). Why?

[EDIT] Also the time zone is different. Why is Java using CEST when it's started from Maven and GMT+01:00 when started from Eclipse?

Or to put it another way: How can I force Java to use either?

3 Answers
Related