How to add a time zone to a pre-existing Date field

Topics: 

If you have a Date field that you had initially set up without a time zone, but realize later that you'd like to include it, it is possible to switch from "No time zone conversion" to "Date's time zone" even though the user interface doesn't recommend it.

Perform the switch in the field settings, but once done, execute the following query:
UPDATE content_field_foo SET field_foo_timezone = 'UTC'

...where content_field_foo is the table containing the date field data, and field_foo_timezone is the time zone column. For each field instance, this will set a proper time zone where there wasn't one before. Without doing this, your dates will show up with different times depending on the site's time zone and your users' time zones.

You may then edit the time zones to something specific other than UTC on each node's edit page.

This was tested on Drupal 6, but the same approach could probably be taken with Drupal 7.

Comments

Add new comment