System.TimeZoneNotFoundException: '在本地计算机上找不到时区 ID 'Asia/Jerusalem'.' [英] System.TimeZoneNotFoundException: 'The time zone ID 'Asia/Jerusalem' was not found on the local computer.'

查看:36
本文介绍了System.TimeZoneNotFoundException: '在本地计算机上找不到时区 ID 'Asia/Jerusalem'.'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗?我什么都试过了!

can somebody help me? I tried everything!

推荐答案

"Asia/Jerusalem" 是 IANA 时区数据库(又名 tzdb 或 tz 或 zoneinfo).Windows 使用自己的时区 ID,它们非常不同.

"Asia/Jerusalem" is an ID in the style used by the IANA time zone database (aka tzdb or tz or zoneinfo). Windows uses its own time zone IDs which are very different.

如果您想以跨平台方式使用 IANA 时区,我建议使用 Noda Time 项目 我维护的,而不是 TimeZoneInfo.

If you want to use IANA time zones in a cross-platform way, I'd suggest using the Noda Time project which I maintain, instead of TimeZoneInfo.

此外,诸如自纪元以来的秒数"之类的值通常时区敏感;Unix 纪元固定在 1970-01-01T00:00:00 UTC,而不是每个时区的当地时间 1970 年 1 月 1 日午夜".虽然这样的值很有用(我们在野田时间内部有这个概念)我会在使用之前非常仔细考虑.理想情况下,坚持更高级别的抽象 - 在 Noda Time 中,我建议使用 ZonedDateTimeInstantLocalDateTime,具体取决于您的要求.

Additionally, values such as "number of seconds since the epoch" are normally not time-zone-sensitive; the Unix epoch is fixed at 1970-01-01T00:00:00 UTC, not "midnight on January 1st 1970 local time on a per time zone basis". While such a value can be useful (we have the concept internally in Noda Time) I would think very carefully before using that. Ideally, stick to a higher level abstraction - in Noda Time, I'd suggest using ZonedDateTime, Instant or LocalDateTime, depending on your requirements.

这篇关于System.TimeZoneNotFoundException: '在本地计算机上找不到时区 ID 'Asia/Jerusalem'.'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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