gpt4 book ai didi

java - Java中的时区

转载 作者:IT老高 更新时间:2023-10-28 21:18:30 34 4
gpt4 key购买 nike

我允许我的网络应用程序上的用户根据他们选择的时区安排 Activity 。

我想向最终用户提供一个很好的时区列表,然后在服务器端轻松地将其转换为 java.util.TimeZone 对象。

String[] TimeZone.getAvailableIds() 是我可以使用的,但问题是它打印了大约 585 个时区 ID。

向用户展示一个简短的时区列表(就像用于时区设置的 Windows 框一样)并在服务器端使用其 ID 轻松转换为 TimeZone 对象的最佳方式是什么?

最佳答案

时区列表非常特定于应用程序和区域设置。只有您知道哪些区域最适合您的用户。实际上,我们针对不同地区有不同的列表。

这是我们的美国用户列表供您引用,

    "Pacific/Midway",
"US/Hawaii",
"US/Alaska",
"US/Pacific",
"America/Tijuana",
"US/Arizona",
"America/Chihuahua",
"US/Mountain",
"America/Guatemala",
"US/Central",
"America/Mexico_City",
"Canada/Saskatchewan",
"America/Bogota",
"US/Eastern",
"US/East-Indiana",
"Canada/Eastern",
"America/Caracas",
"America/Manaus",
"America/Santiago",
"Canada/Newfoundland",
"Brazil/East",
"America/Buenos_Aires",
"America/Godthab",
"America/Montevideo",
"Atlantic/South_Georgia",
"Atlantic/Azores",
"Atlantic/Cape_Verde",
"Africa/Casablanca",
"Europe/London",
"Europe/Berlin",
"Europe/Belgrade",
"Europe/Brussels",
"Europe/Warsaw",
"Africa/Algiers",
"Asia/Amman",
"Europe/Athens",
"Asia/Beirut",
"Africa/Cairo",
"Africa/Harare",
"Europe/Helsinki",
"Asia/Jerusalem",
"Europe/Minsk",
"Africa/Windhoek",
"Asia/Baghdad",
"Asia/Kuwait",
"Europe/Moscow",
"Africa/Nairobi",
"Asia/Tbilisi",
"Asia/Tehran",
"Asia/Muscat",
"Asia/Baku",
"Asia/Yerevan",
"Asia/Kabul",
"Asia/Yekaterinburg",
"Asia/Karachi",
"Asia/Calcutta",
"Asia/Colombo",
"Asia/Katmandu",
"Asia/Novosibirsk",
"Asia/Dhaka",
"Asia/Rangoon",
"Asia/Bangkok",
"Asia/Krasnoyarsk",
"Asia/Hong_Kong",
"Asia/Irkutsk",
"Asia/Kuala_Lumpur",
"Australia/Perth",
"Asia/Taipei",
"Asia/Tokyo",
"Asia/Seoul",
"Asia/Yakutsk",
"Australia/Adelaide",
"Australia/Darwin",
"Australia/Brisbane",
"Australia/Sydney",
"Pacific/Guam",
"Australia/Hobart",
"Asia/Vladivostok",
"Asia/Magadan",
"Pacific/Auckland",
"Pacific/Fiji",
"Pacific/Tongatapu",

关于java - Java中的时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1694885/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com