MySQL now() change timezone

后端 未结 4 1143
庸人自扰
庸人自扰 2020-12-20 13:51

I\'m using the following INSERT statement:

INSERT INTO messages SET `to` = \'\".$to.\"\', `from` = \'\".$this->userid.\"\', `title` = \'\".$title.\"\', `m         


        
4条回答
  •  鱼传尺愫
    2020-12-20 14:22

    After you open the connection to MySQL, run the following as a query:

    SET time_zone = timezone;
    

    Then all functions you do will run for that timezone for that connection (i.e. until you close the "link" to the database".

    If you have the appropriate permissions you can lock it "permanently" / globaly. Tiemzone strings are standard strings as you have in your question.

    http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html

提交回复
热议问题