Why Joda DateTimeFormatter cannot parse timezone names ('z')

后端 未结 3 1938
有刺的猬
有刺的猬 2020-12-09 16:58

From DateTimeFormatter javadoc:

Zone names: Time zone names (\'z\') cannot be parsed.

Therefore timezone parsing like:

相关标签:
3条回答
  • 2020-12-09 17:24

    Probably because some time zone abbreviations are ambiguous and the parser can't know which time zone is meant.

    It might of course also be one of the tiny, strange ticks and missing features you find after working with Joda for a while.

    0 讨论(0)
  • 2020-12-09 17:41

    Abbreviated time zones are indeed ambiguous and Joda took a step further removing support for them as stated in the DateTimeZone javadoc:

    0 讨论(0)
  • 2020-12-09 17:43

    I think that the reason is that 'z' timezone names are conventional (not standardized) and ambiguous; i.e. they mean different things depending on your country of origin. For example, "PST" can be "Pacific Standard Time" or "Pakistan Standard Time".

    If you are interested, this site has a listing of a large number of timezone names. It is not difficult to spot cases where there is ambiguity.

    0 讨论(0)
提交回复
热议问题