Our customers, from all over the globe, can create events (both one-time and weekly recurring). The formula we are using to calculate the next instance of a recurring event is (in psuedo code):

is current time less than event start?
if so, return event start date/time.

if not, add 1 week to event start. loop until current time is less than new event start and return new event start.

The calculation for one-time events can be done in either local TZ or GMT.

But when you throw in the adding of weeks to an original start date, should the orig start date be in local TZ or GMT?

Thanks,
Matthew

Zefram wrote:
Matthew wrote:
Thanks Zefram. To combat this issue in the future, should we be storing our customer's event information in our DB in GMT and doing all calculations using GMT? or store in their local TZ and calculate with local TZ?

That depends on what you need to do with the data.  If you want to do date
arithmetic that is affected by the customer's timezone then you definitely
need to store which timezone that is.  For any event information where
it is only the absolute time that matters, I recommend storing in GMT.
Perform calculations in GMT or local time depending on what type of
calculation you intend to perform.

Our servers are all GMT if that makes any difference.

This is wise.

-zefram

Reply via email to