时区列表问题 [英] Time zone list issue

查看:141
本文介绍了时区列表问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的应用程序,我从Google日历导入日历事件。我所面临的唯一问题是时区列表。我得到时区作为谷歌日历xml的输出,我必须检查与时区列表,并相应地添加时间...所以从哪里可以得到这个标准的时区列表..或一些其他替代方案来实现相同

For my application, I'm importing the calendar event from google calendar. The only problem which I'm facing is Time zone list. I'm getting the timezone as output from google calendar xml, which I have to check with time zone list and add time accordingly... so from where I can get this standard time zone list.. or some other alternative to achieve the same.

推荐答案

如果您使用Java,请使用 Joda时间 - Google日历给出的时区ID将是Joda时间了解的时区ID。标准的 TimeZone 类也可以很好地理解,但我认为Joda更有可能。

If you're using Java, use Joda Time - the time zone ID given by Google Calendar will be one the Joda Time understands. The standard TimeZone class may well understand it too, but I think Joda is more likely to.

假设你'重新看到与事件相关的所有VTIMEZONE内容,您可以忽略细节 - 只需使用ID。

Assuming you're seeing all the VTIMEZONE stuff that goes along with the event, you can ignore the details - just use the ID.

不幸的是有一些时区ID已经更改时间 - 我不记得任何一个例子,但如果你提供了旧的名字,你可能需要做一些翻译。

Unfortunately there are some time zone IDs which have changed over time - I can't remember any examples off-hand, but you may need to do some translations if you're provided with the "old" names.

如果你使用.NET,您真的需要使用.NET 3.5和 TimeZoneInfo 类。不幸的是,使用Windows名称而不是Olson ID,但是有一个翻译列表可以在某个地方使用(如果需要的话可以挖掘出来)。

If you're using .NET, you really need to be using .NET 3.5 and the TimeZoneInfo class. Unfortunately that uses Windows names instead of Olson IDs, but there's a translation list available somewhere (I can dig it out if you want).

如果你不使用在这些平台中,您基本上需要找到一个支持 Olson Zoneinfo名称的库。 (那个维基百科的文章有一些有用的链接在底部。)

If you're not using either of these platforms, you basically need to find a library which supports Olson Zoneinfo names. (That wikipedia article has some helpful links at the bottom.)

我一定会尝试找到一个库,将能够给你相关的信息,基于一个ID ,而不是使用日历条目中给出的规则。时区随时间变化,zoneinfo数据库包含历史和将来的信息,但不能在日历条目中轻松编码。

I would definitely try to find a library which will be able to give you the relevant information based on an ID, rather than using the rules given back in the calendar entry. Time zones change over time, and the zoneinfo database contains historical and future information, but that can't be easily encoded in the calendar entry.

这篇关于时区列表问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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