I have a large application with 500+ tables, I have to convert the application to be timezone aware (currently application uses new java.util.Date()
, GETDATE()
with server's timezone). i.e. no timezone support whatsoever.
I have organised this task into a few steps so as to ease development, my first identified step is to change all old dates to UTC
based on the server's timezone. (mostly located in one timezone, so this is my best guess)
Next, I need to modify the database and application code to save all dates in UTC with a timezone name and offset, this is where my problem comes in...
How would i go about modifying the database/tables to support this in a good manner?
My ideas were to:
- for each date/time column in a table, add two extra columns (for tz-name & offset)
- this feels like bad design
- add one table with columns
pk
,TABLE_NAME
,COL_NAME
,ROW_PK
,TZ_NAME
,TZ_OFFSET
- although more portable, this table will contain millions of rows evetually, since it is the whole database's dates crammed into one table
- add a new table for each existing table (one-to-one) with tz-names, and offsets for each date column
- although not portable, this seems like the best (relational) option
Does anyone have any other ideas or best-practices?