Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you deal with timezone issues? [duplicate]

For a scheduling system, what's the best way to save the timezone of client/event in a central server database coming from multiple sources mobile,web,client app.

  • How do you store the dates? Alarms, reminders etc...
  • How do you handle the DST setting?
  • How do you handle the events if client has traveled to a different location?

I need the solution to work with all databases in tags.

like image 681
Pentium10 Avatar asked Jan 27 '10 15:01

Pentium10


People also ask

How does Java handle time zone issues?

The Right Way: TZDB Timezone ID The right way to handle DST in Java is to instantiate a Timezone with a specific TZDB Timezone ID, eg. “Europe/Rome”. Then, we'll use this in conjunction with time-specific classes like java.

How do you change timezone from one time zone to another in python?

Convert to new timezone using . astimezone() on the newly localized datetime/timestamp from step 2 with the desired timezone's pytz object as input e.g. localized_timestamp. astimezone(new_timezone) .


2 Answers

Everything in UTC, and another column for the offset.

like image 100
Ignacio Vazquez-Abrams Avatar answered Sep 27 '22 21:09

Ignacio Vazquez-Abrams


These are the key points to the strategy I tend to use.

  • Every date is UTC internally to the system.
  • Users are shown dates in the their local timezone.
  • We allow users to override the timezone they are using in case they travel and they want to keep the timezone consistent.
  • Make the timezone easily visible. Either display it with the time or as part of the column header.
like image 43
Steve g Avatar answered Sep 27 '22 22:09

Steve g