Tuesday, August 23, 2005

Localized dates the JDBC way

An investigative coworker (Todd) found this that explains a method of translating a given Calendar object into a GMT Timestamp. Likewise, retrieving the date in a specific locale can be achieved through ResultSet.getTimestamp the Timestamp can be localized. Now that all of the code for *doing* this is already in place it'd be a mighty pain to rip it out and refactor.

Implementing the above is a great option if you need a blanket solution. Frankly, I agree with Todd that we should be storing everything in GMT anyway. At this point in the game that's not feasible and we need specific GMT/Localizable functionality on only a few specific columns. Future situations may present alternative necessities.

3 comments:

Joe said...
This comment has been removed by a blog administrator.
Hank said...
This comment has been removed by a blog administrator.
Andrea Peterson said...
This comment has been removed by a blog administrator.