如何在Java中的Windows和IANA时区之间转换 [英] How to translate between windows and IANA timezones in java

查看:142
本文介绍了如何在Java中的Windows和IANA时区之间转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在IANA时区& Windows时区&反之亦然.报告了另一个问题:如何在Windows和IANA时间之间进行转换区域?

I need to translate between IANA timezone & windows timezone & vice-versa. There is another question reported: How to translate between Windows and IANA time zones?

它指定可以在.Net中使用Noda时间库

It specifies that Noda time library can be used in .Net

我们有Java中要使用的任何库吗?还是要在Java中使用的任何其他实用程序?

Do we have any library to be used in Java? Or any other utility to be used in java?

推荐答案

我终于不得不进行自己的实现.

I finally had to make my own implementation. The windowsZones.xml needs to be updated for plenty of missing timezone entries. I'm not publishing the updated file as there are many timezones where there is no perfect match between Windows offset & IANA offset.

此外,对于一个Windows时区,可能会有多个IANA时区.因此,我必须根据用户(地址)的地理位置等其他可用信息,制定实施方案以选择最适合的人.

Also, as for one Windows timezone there could be multiple IANA timezone. So, i had to make implementation to choose best suitable according to other information available like geography of user(address) etc.

有了这个,我只是使用windowsZones.xml从Windows时区&中获取IANA时区.反之亦然.

With this, I'm just using the windowsZones.xml to get IANA timezone from Windows timezone & vice-versa.

这篇关于如何在Java中的Windows和IANA时区之间转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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