Storing datetime as UTC in PHP/MySQL

前端 未结 6 1621
悲哀的现实
悲哀的现实 2020-11-30 22:08

Everywhere I read about converting time to a user\'s timezone says that the best method is to store a date and time in UTC then just add the user\'s timezone offset to this

6条回答
  •  無奈伤痛
    2020-11-30 22:35

    NOW() gives you the time (including the timezone offset) of the system running your database. To get UTC date/time you should use UTC_TIMESTAMP() as described in the MySQL Reference Manual.

提交回复
热议问题