Epoch is not epoch if do a new Date(0L). Why ?

Posted by Antoine Claval on Stack Overflow See other posts from Stack Overflow or by Antoine Claval
Published on 2010-03-12T17:27:46Z Indexed on 2010/03/12 17:37 UTC
Read the original article Hit count: 364

Filed under:
|
|

My problem is pretty straigtforward explained :

if i do this :

public class Main {

public static void main(String[] args) throws Exception {
        Date d = new Date(0L );
        System.out.println(d);
}

}

I get the following output : Thu Jan 01 01:00:00 CET 1970

According to the doc, i was expecting : Thu Jan 01 00:00:00 CET 1970

I would like was going wrong...

EDIT : Indeed, i read the doc too fast. I sould have Thu Jan 01 00:00:00 GMT 1970

So, how can i force the use of GMT, and ignore all local time ?

© Stack Overflow or respective owner

Related posts about java

Related posts about date