Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store UTC date time in database

I will convert all date & time input by user (local time) to UTC and store it in database. When display back I will convert UTC time to their time zone which is set in their profile. Is it good?

like image 946
complez Avatar asked Sep 27 '10 15:09

complez


2 Answers

I think it's good enough. Besides storing user timezone in profile, you can also let client (for example, javascript) convert UTC time according to user computer time zone.

like image 70
a1ex07 Avatar answered Sep 25 '22 06:09

a1ex07


As long as you can convert to/from any time zone from your stored DB records, that's all you need.

What you've described will work.

like image 25
John Avatar answered Sep 23 '22 06:09

John