设置MySQL的时区(Setting timezone for MySQL)

编程入门 行业动态 更新时间:2024-10-27 18:17:56
设置MySQL的时区(Setting timezone for MySQL)

我使用PHP来设置网站的当前时区:

date_default_timezone_set('America/New_York');

我怎么能同时为mysql设置相同的时区,这样当我使用NOW()时它会使用在php中设置的时区?

Im using php to set the current timezone for a site:

date_default_timezone_set('America/New_York');

How could I, at the same time, set the same time zone for mysql so that when I use NOW() it uses the timezone set in php?

最满意答案

别。

最佳做法是将UTC存储在数据库中。

Don't.

The best practice is to store UTC in the database.

更多推荐

本文发布于:2023-08-07 20:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465662.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时区   MySQL   timezone   Setting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!