How do I make MySQL's NOW() and CURDATE() functions use UTC?

后端 未结 7 957
闹比i
闹比i 2020-12-08 13:17

I want to make it so calls to NOW() and CURDATE() in MySQL queries return the date in UTC. How do I make this happen without going through and changing all queries that use

7条回答
  •  感情败类
    2020-12-08 14:09

    Goto /etc/mysql/my.cnf file and add this below line under [mysqld] section

    default-time-zone = '+00:00'

    Then restart your mysql. Now select curtime(); shows the GMT time.

提交回复
热议问题