Hi all,

I'd like to know what conventions you've established for your sites that
deal with users in many time zones.

Do you simply replace the converters (Date, SqlDate, SqlTime, SqlTimestamp)?

Do you avoid MessageFormats in StringResourceModels? (I don't see a way to
configure its MessageFormat.)

We currently bypass this stuff and do our formatting with application
utility methods, and adapting input into users' timezones as manual steps,
e.g. with Joda-Time's DateTime#withZoneRetainFields().

I'd like to sweep this stuff under the rug with some application-level
configuration, e.g. of converters. But before I embark, I was hoping to
hear from someone who's already gone on this journey.

And related: maybe you have some golden rules time zone handling to share?
A couple of mine are:
1. Avoid "date" types in SQL tables because it's hard to correctly compare
to "now" across timezones.
2. Anything that shifts millis to adjust for timezones is a red flag
(including the aforementioned #withZoneRetainFields() sadly).
3. java.util.Date is evil and you should avoid it whenever possible.
Calendar is marginally better, but Joda-Time is the way to go.

Thanks,
Dan

Reply via email to