E
epicwinter
epicwinter said:Arne- I am sorry but I don't understand what you mean by it is just
formatting. In my database i [sic] only store a date type that includes
month, day, year. When I load that into a Date class it automatically
assigns the local timezone and i [sic] get 02-21-2009 00:00:00 CST or
whatever the time zone is. If that date is then viewed on a client on
PST then it is 02-20-2009 22:00:00 PST. So the date portion shows the
day before.
What he means is that java.util.Date does not store timezone information. All
that information is added by the code that displays the value - that is what
"just formatting" means.
Let me repeat that: java.util.Date does not store timezone information. There
is no "automatically assigns the local timezone" when you store a value into a
Date. It all happens on the formatting of the display of the value.
All java.util.Date stores is a 'long' value. Classes like java.util.Calendar
and java.text.DateFormat store timezones, but java.util.Date does not.
Fair enough, but by default it uses the timezone of the computer
whenever you get the values. What strategy would you recommend to
change it so I am ignorant of the timezone by default?