douyi9447 2010-08-12 10:14
浏览 807
已采纳

MySQL默认时间格式UTC或GMT?

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

  • 写回答

1条回答 默认 最新

  • dousi1906 2010-08-12 10:30
    关注

    The docs are an excellent read.

    CONVERT_TZ(dt,from_tz,to_tz)
    

    CONVERT_TZ() converts a datetime value dt from the time zone given by from_tz to the time zone given by to_tz and returns the resulting value. Time zones are specified as described in Section 9.6, “MySQL Server Time Zone Support”. This function returns NULL if the arguments are invalid.

    The current values of the global and client-specific time zones can be retrieved like this:

    mysql> SELECT @@global.time_zone, @@session.time_zone;
    

    The timezone values can be given in several formats, none of which are case sensitive:

    • The value 'SYSTEM' indicates that the time zone should be the same as the system time zone.
    • The value can be given as a string indicating an offset from UTC, such as '+10:00' or '-6:00'.
    • The value can be given as a named 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突