如何从偏移量中获取时区名称? [英] How to get time zone name from an offset?

查看:38
本文介绍了如何从偏移量中获取时区名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用时刻时区进行时区计算.我有一些来自数据库的偏移数据,如 GMT、GMT+1、GMT+2、GMT+3、GMT+4 等

无论如何我可以从这些数据中获取时区或时区名称,例如America/Los_Angeles"吗?

解决方案

我不是说粗鲁,而是说真的——我要喊多少次,喊多少次?

时区 != 偏移量

我的意思是 - 它只在

...

并不是我还没有回答过

提前为这个尖刻的答案道歉,但由于重复的重复并没有那么有趣.

I am using moment timezone for timezone calculations . All i have some offset data coming from db like GMT,GMT+1,GMT+2,GMT+3,GMT+4 etc

Is their anyway i could get the timezone or timezone name like "America/Los_Angeles" from this data ?

解决方案

I don't mean to be rude, but seriously - How many times and how loudly do I have to shout this?

Time Zone != Offset

I mean - it's only in the tag header, and the body of the timezone tag wiki:

...

And it's not like I haven't already answered this question, or this one, or addded it to the best practices doc, or littered what must be hundreds of other posts with "Time Zone != Offset" comments...

I know, maybe I'll go talk about this at a high profile developer conference with "Time Zone != Offset" on my shirt just so it sinks in. Oh wait - done that already too.

Apologies in advance for the snarky answer, but close as duplicate of duplicate of duplicate just wasn't as much fun.

这篇关于如何从偏移量中获取时区名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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