将 GMT 时间转换为 EST [英] convert GMT time to EST

查看:58
本文介绍了将 GMT 时间转换为 EST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 sql server 位于格林威治标准时间,我需要获得 EST 等效的 tz.

My sql server is located in GMT and I need to get the EST equivalent tz.

不知何故,EST 是错误的.

Somehow the EST is wrong.

select now(),convert_tz(now(),'GMT','EST'),convert_tz(now(),'GMT','EST') - interval 10 minute

美国东部时间应该是 20:30 而不是 19:30

The EST time should be 20:30 and not 19:30

这是我的结果 -

推荐答案

正如@ceejayoz 提到的,地点的时区会根据夏令时的观察而变化.此外,将其称为 UTC 而不是 GMT 更合适,因为当您称其为 GMT 时,它意味着您的服务器已调整到某个本地时间,例如伦敦时间,并且您的服务器时间将切换到其他时间,比如说 BST,当观察到夏令时.

As @ceejayoz mentioned, the timezones of locations change depending on daylight savings observation. In addition, it's more proper to call it UTC rather than GMT, as when you call it GMT, it connotes that your servers are tune to some local time, say, London time, and that your server's time will switch to some other time, say BST, when daylight savings is observed.

假设,正如我假设您正在尝试沟通,您的服务器设置为 UTC 时间,从不遵守夏令时,并且您想将其转换为美国东部大多数城市所遵守的时间,一个解决方案是

Assuming, as I presume you are trying to communicate, that your servers are set to UTC time, never observing daylight savings, and that you want to translate it to the time observed by most Eastern US cities, a solution would be

SELECT NOW(),
  CONVERT_TZ(NOW(), 'UTC', 'America/New_York'),
  CONVERT_TZ(NOW(), 'UTC', 'America/New_York') - INTERVAL 10 MINUTE;

这篇关于将 GMT 时间转换为 EST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆