Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

painful java.util.Date bug

 
aulo aasmaa
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

returns me the GMT time, even though I am located in GMT+2.
If my desktop clock shows 8:58, then the previous statement prints out 6:58.
Now where does this bug hide?
OK!
AUlo
 
Sunetra Saha
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have to use the DateFormat class in java.text to format the date to your local time/date format.
 
Chad McGowan
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure your locale is set correctly in your JVM. Use:
System.out.println(Locale.getDefault());
to see where the JVM thinks you are...
 
aulo aasmaa
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tnx, I have all the system keys in front of me:

The system kept counting with GMT as long as I made the default locale to GMT+2. It works fine now and all dates are displayed correctly in my JTable.
Tnx to everybody!
OK!
AUlo
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!