timezone - MySQL datetime with different time zones -


i have datetime object in mysql database containing example datetime "2017-08-14 18:06:40" , server/mysql default timezone usa when insert datetime goes in time zone .

my problem when user let's europe select datetime , different because of timing difference isn't ?

how solve problem. want user in europe datetime relative timezone

i found searching this

convert_tz(`comment_date`,@@global.time_zone,@@session.time_zone) comment_date, 

then found need set @@session.time_zone not detected automatically

so how solve , option , techniques sites or apps uses unification datetime across countries?

you should change datatype timestamp instead of datetime if want represent instant moment in time regardless of timezone saved. timestamp saved utc while datetime represents local date , time , not contain zone information.

see question more information: should use field 'datetime' or 'timestamp'?

see mysql reference manual regarding datetime


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -