MySQL now() change timezone

后端 未结 4 1147
庸人自扰
庸人自扰 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:35

    $myDateTime = new DateTime('2012-05-23 17:01', new DateTimeZone('GMT'));
    $myDateTime->setTimezone(new DateTimeZone('Asia/Kolkata'));
    echo $myDateTime->format('Y-m-d H:i');
    

    After modification to above code, such as desired format; you could use $myDateTime variable to insert into database.

提交回复
热议问题