Reputation: 19528
I was looking thru the search here and found lots of way to convert the time in MySQL but am yet to find what would be the best way to manage users time offset.
On the signup of my website I have an option to allow the user to pick what timezone he wants the website displayed in, how should I save the time offset the user picked ?
VARCHAR
field on my MySQL table ?small int 4
field and store it as -1200 ~ 1300
format to later reuse for conversion ?or what would be the most appropriate way to store the time offset in a way it would be later beneficial to me considering it could be reused in queries or on the PHP itself ?
Upvotes: 2
Views: 116
Reputation: 437524
You should probably store the timezone name as a string that you can later directly feed into the constructor of DateTimeZone
. It's also human-readable as a bonus.
Upvotes: 2