This content has been marked as final. Show 2 replies
That's correct. The date retained its absolute value. Its original value at the original location was midnight. At the new location it is three hours earlier, because the new location is three hours later.
ewterwytryu wrote:The Data class in java is a wrapper around a millisecond value that always represents a time in UTC (GMT). That millisecond value can then be displayed in many different formats, and the normal toString() on a date returns the milliseconds formatted into a string with timezone information. That timezone information is taken from the machine that is executing toString().
but its date become Mar 01, 2010 *21:00:00*, also three hour difference, may I know what happened? how do I prevent this happened?
Use a SimpleDateFormat if you want to create a string representation that represents another timezone (or format).
Nothing of this is related to Serialization, and it's all documented in the javadoc for Date.