Gmt - A bizarre phenomenon in my java program

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I found a bizarre phenomenon in my java program at runtime, just look at my code:

System.out.println(" date " + new Date(1359931355141L).toGMTString() );

the output by this statement was "date 3 Feb 2013 22:42:35 GMT", and

System.out.println(" date " + new Date(1359931355141L).getDate() );

the output by this was "date 4 " , see, why not 3 here ???

I could not figure out what s wrong with my program; I am doubting whether my JVM ran into bugs.
Guys, would you like to have a test on your JVM for this two statements?

Answers

Because you live east of central Europe (in a timezone that is at least GMT+1.5Hr).

http://docs.oracle.com/javase/6/docs/api/java/util/Date.html#getDate%28%29 http://docs.oracle.com/javase/6/docs/api/java/util/Date.html#getDate%28%29

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/17593385/a-bizarre-phenomenon-in-my-java-program

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils