Every so often I get myself confused about Java’s often-obtuse handling of dates and timezones. So, for my future self’s benefit, here are some reminder notes…
Please leave a comment if you have corrections or additional tips! (And, preemptively, yes, some day I’ll give Joda Time a try.)
Dates do not have timezones; they reflect UTC.
Stringrepresentation based on the local machine’s default timezone. This makes people think that
Dates have timezones.
- You cannot convert a
Datefrom one timezone to another.
- However, you can use
DateFormatto affect the
Stringrepresentation of a
Date, including the timezone.