This page discusses the issues with serializing dates (which includes serializing to a database).
In a sunny day scenario, the date that is stored should be retrieved the same when pulled back. However, this is not always possible.
- save a time
- change the time zone rules
- load the time
then you may have a problem. The time that you stored may now be invalid according to the new time rules. So what should happen?
- Instants store the duration from the epoch to the serialized-form - time zone rules are not relevant
- Time points store the fields to the serialized-form - thus they need some way to solve the problem outlined above - see invalid input details
- Any time serialization should also serialize the TimeZone with it. Automatic localization of times to the local TimeZone may cause severe problems. Consider some i.e. RMI communication across TimeZone boundaries. Conversions to local time could be done manually/intentionally by some static helper method i.e.:
TimePoint TimePoint.convertToLocalTime(TimePoint t)
-- Main.sven_de - 18 Dec 2008