Deepakmahajan
Deepakmahajan

Reputation: 866

How to handle the different timezone in mysql?

user login from india at 9:00 am other user from usa at other time.

how handle this if both the user having same server but login from different timezone

Upvotes: 1

Views: 459

Answers (2)

Tudor Constantin
Tudor Constantin

Reputation: 26871

You could store timezone offset for each user (make the user select one timezone when he creates the account) and do the transformations based on that

Upvotes: 1

Jonathan Hall
Jonathan Hall

Reputation: 79784

You haven't really told us what your problem is, but the best way to handle multiple timezones is to always store your timestamps in UTC, and convert from local to UTC on insert, and from UTC to local for display.

Upvotes: 3

Related Questions