MySQL默认时间格式UTC还是GMT?
您好,我对这个 UTC 和 GMT 很困惑,
我在 MySQL 表中插入前列“event_date”,如“2010-07-01 23:50:00”(日期时间),我的客户在前端询问 GMT 选项+1 GMT +2 GMT -1 GMT -2 ...等如果我选择任何选项 GMT +2,event_date 将根据 GMT +2 进行过滤/列表。
我不知道如何继续,在谷歌搜索后我发现了这个
CONVERT_TZ( `field_eventdate_value` , '+00:00', '+10:00' )
以及它是否运行良好,我的客户给了我一个示例 URL 来检查,如下所示
http://www.forexpros.com/economic-calendar/
我正在使用 drupal 节点
提前致谢,
戈壁
Hi I'm so confused with this UTC and GMT
I'm inserting in MySQL table as ex column "event_date" like "2010-07-01 23:50:00" (datetime) my client asking an option in front end as GMT +1 GMT +2 GMT -1 GMT -2 ...etc if I select any option GMT +2 the event_date will filter/list according to the GMT +2.
I have no idea how to proceed and after googling I found this
CONVERT_TZ( `field_eventdate_value` , '+00:00', '+10:00' )
and whether it works well and my client gave me a sample URL to check like this
http://www.forexpros.com/economic-calendar/
I'm working with drupal nodes
Thanks in advance,
Gobi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文档是一本极好的读物。
CONVERT_TZ()
将日期时间值dt
从from_tz
指定的时区转换为to_tz
指定的时区并返回结果值。时区的指定如第 9.6 节 “MySQL 服务器时区支持”中所述。如果参数无效,此函数将返回NULL
。可以像这样检索全局和客户端特定时区的当前值:
timezone
值可以多种格式给出,其中任何格式都不区分大小写:时区应该与
系统时区。
表示与 UTC 的偏移量,例如
如“+10:00”或“-6:00”。
时区,例如“欧洲/赫尔辛基”,
“美国/东部”或“MET”。指定时间
仅当时间允许时才可以使用区域
mysql 中的区域信息表
数据库已创建并且
人口稠密。
PS:了解GMT 与 UTC关于.com。 GMT 是伦敦格林威治的太阳时,而 UTC] 是基于国际原子时 (TAI) 的时间标准,不定期添加闰秒以补偿地球自转速度减慢。如果将其视为时区,则两者是相同的。
The docs are an excellent read.
CONVERT_TZ()
converts a datetime valuedt
from the time zone given byfrom_tz
to the time zone given byto_tz
and returns the resulting value. Time zones are specified as described in Section 9.6, “MySQL Server Time Zone Support”. This function returnsNULL
if the arguments are invalid.The current values of the global and client-specific time zones can be retrieved like this:
The
timezone
values can be given in several formats, none of which are case sensitive:time zone should be the same as the
system time zone.
indicating an offset from UTC, such
as '+10:00' or '-6:00'.
time zone, such as 'Europe/Helsinki',
'US/Eastern', or 'MET'. Named time
zones can be used only if the time
zone information tables in the mysql
database have been created and
populated.
PS: Read about GMT vs UTC on About.com. GMT is the solar time at Greenwich, London while UTC] is a time standard based on International Atomic Time (TAI) with leap seconds added at irregular intervals to compensate for the Earth's slowing rotation. Both are same if viewed as a time-zone.