Forum OpenACS Development: Re: Timezones

Collapse
2: Re: Timezones (response to 1)
Posted by Eduardo Pérez on
date/times must always be stored in UTC in the DB, then they can be converted to whatever timezone the user wants.

Then the dates can be shown in the specified user's local timezone or in UTC if the user didn't specify a timezone or the local time (OACS system timezone setting) if the site is a one timezone only site.

So you don't need 'lc_time_system_to_user' and 'lc_time_user_to_system' because date/times must the in UTC in the DB

Collapse
3: Re: Timezones (response to 2)
Posted by Jeff Davis on
I guess it was Ash Katwala and I that inflicted those procs on the world.  One point is that I disagree with the ACS Java docs (and agree with Eduardo) that date/times should be UTC in the DB (although I also think the server should be on UTC as well so in some sense it is the same answer).  Unfortunately we rely on the DB datetime formatting all over the place
which means running everything as UTC and formatting on
output is problematic.

Anyway, those routines were the lowest level ones on which
something like lc_time_utc_to_user would be built.

Also, keep in mind that in some cases you want the time you
present to be something other than the users timezone.
An example would be a travel itenerary where the departure
times should be the local timezone for the airport.