• Post Reply Bookmark Topic Watch Topic
  • New Topic

Vista OS java.util.Date class is showing GMT time rather then local time.  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I am using java.util.Date class in java program to get local time (System time) however it's showing me GMT time.

I was using this code.

JLabel jl = new JLabel();
java.util.Date d = new java.util.Date();
java.text.SimpleDateFormat f =new java.text.SimpleDateFormat("HH:mm:ss");
jl.setText(f.format(d));

Thanks in Advance
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be related to this bug.
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, which version of Java are you using exactly? The bug that Christophe mentioned was fixed in Sun Java 5 update 10, according to the bug report. Java 5 is already at update 18 at the moment. See if you can update to a newer version. (Ofcourse it would be even better if you could upgrade to Java 6).
 
mannu shukla
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Jesper Young, Christophe

I am So grateful to you sir for your solution. I tried running the same application on version jdk1.6. It is working fine sir.

I highly appreciate you quick response in this regards.


Regards
Mannu Shukla
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!