C# 时区
- Windows 时区,在 Windows 平台实现,例:"China Standard Time"
- Olson(奥尔森)时区,在 Linux,Mac,IOS,Andorid,JavaScript 和许多其他平台上广泛实现,例:"Asia/Shanghai"
如果系统不考虑全球化的话,那么我们不用考虑时区的问题,因为我们可以认为中国境内的计算机全部用的是北京时间。
安装以下两个 Nuget 包
- NodaTime
- TimeZoneConverter
TimeZoneInfo
TimeZoneInfo 是一个关于时区的静态类,可以使得我们方便的操作与时区相关的信息
对于一个开放于全球的网站或服务,在时间上的显示是一个问题,因为各个国家都会有所谓的时差,好在 .Net 提供了 TimeZoneInfo 类来解决这个问题。
TimeZoneInfo 类的方法可用于将一个时区的时间转换为其他任意时区的相应时间
静态成员:
- Local 属性:实例化表示本地时区的 TimeZoneInfo 对象。
- Utc 属性:实例化表示 UTC 时区的 TimeZoneInfo 对象。
- CreateCustomTimeZone()使用应用程序提供的数据创建自定义时区。 - CreateCustomTimeZone 方法创建在本地系统注册表中未定义的时区。然后可使用 ToSerializedString 属性将时区对象的信息保存为字符串,该字符串可以以应用程序可访问的某种格式存储。使用 FromSerializedString 方法可将序列化字符串转换回 TimeZoneInfo 对象
- FindSystemTimeZoneById()根据时区的标识符实例化在系统注册表中定义的时区。
- FromSerializedString()反序列化一个字符串值,以重新创建先前已序列化的 TimeZoneInfo 对象。
- GetSystemTimeZones()返回 TimeZoneInfo 对象的可枚举的 ReadOnlyCollection<(Of <(T>)>),它表示本地系统上可用的所有时区。
获取 TimeZoneInfo
//.net 自带
Console.WriteLine(TimeZoneInfo.Local);//服务器时间
Console.WriteLine(TimeZoneInfo.Utc);//UTC时间
//TimeZoneConverter
Console.WriteLine(TZConvert.GetTimeZoneInfo("Central Standard Time"));//中部时间(美国和加拿大)
Console.WriteLine(TZConvert.GetTimeZoneInfo("America/New_York"));//美国时间
Console.WriteLine(TZConvert.GetTimeZoneInfo("Asia/Shanghai"));//上海时间
时间转换
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");
DateTime dateTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZoneInfo);
DateTime dt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now, TimeZoneInfo.Local);
DateTime dt1 = TimeZoneInfo.ConvertTimeFromUtc(dt, timeZoneInfo);
//NodaTime方式
Instant now = SystemClock.Instance.GetCurrentInstant();
var shanghaiZone = DateTimeZoneProviders.Tzdb["Asia/Shanghai"];
var shanghaiZone2 = NodaTime.DateTimeZoneProviders.Tzdb.GetZoneOrNull("America/New_York");
DateTime dateTime3= now.InZone(shanghaiZone).ToDateTimeUnspecified();
获取全部 TimeZoneInfo
代码
//获取所有Standard Time
foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
{
Console.WriteLine(z.Id + "," + z.BaseUtcOffset + "," + z.StandardName + "," + z.DisplayName + "," + z.DaylightName);
System.Diagnostics.Debug.WriteLine(z.Id + "," + z.BaseUtcOffset + "," + z.StandardName + "," + z.DisplayName + "," + z.DaylightName);
}
//NodaTime
var list = NodaTime.DateTimeZoneProviders.Bcl.Ids;
时区列表
{
tZCode : "Morocco Standard Time",
tZDesc : "(GMT) Casablanca"
},
{
tZCode : "GMT Standard Time",
tZDesc : "(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London"
},
{
tZCode : "Greenwich Standard Time",
tZDesc : "(GMT) Monrovia, Reykjavik"
},
{
tZCode : "W. Europe Standard Time",
tZDesc : "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"
},
{
tZCode : "Central Europe Standard Time",
tZDesc : "(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague"
},
{
tZCode : "Romance Standard Time",
tZDesc : "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris"
},
{
tZCode : "Central European Standard Time",
tZDesc : "(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb"
},
{
tZCode : "W. Central Africa Standard Time",
tZDesc : "(GMT+01:00) West Central Africa"
},
{
tZCode : "Jordan Standard Time",
tZDesc : "(GMT+02:00) Amman"
},
{
tZCode : "GTB Standard Time",
tZDesc : "(GMT+02:00) Athens, Bucharest, Istanbul"
},
{
tZCode : "Middle East Standard Time",
tZDesc : "(GMT+02:00) Beirut"
},
{
tZCode : "Egypt Standard Time",
tZDesc : "(GMT+02:00) Cairo"
},
{
tZCode : "South Africa Standard Time",
tZDesc : "(GMT+02:00) Harare, Pretoria"
},
{
tZCode : "FLE Standard Time",
tZDesc : "(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius"
},
{
tZCode : "Israel Standard Time",
tZDesc : "(GMT+02:00) Jerusalem"
},
{
tZCode : "E. Europe Standard Time",
tZDesc : "(GMT+02:00) Minsk"
},
{
tZCode : "Namibia Standard Time",
tZDesc : "(GMT+02:00) Windhoek"
},
{
tZCode : "Arabic Standard Time",
tZDesc : "(GMT+03:00) Baghdad"
},
{
tZCode : "Arab Standard Time",
tZDesc : "(GMT+03:00) Kuwait, Riyadh"
},
{
tZCode : "Russian Standard Time",
tZDesc : "(GMT+03:00) Moscow, St. Petersburg, Volgograd"
},
{
tZCode : "E. Africa Standard Time",
tZDesc : "(GMT+03:00) Nairobi"
},
{
tZCode : "Georgian Standard Time",
tZDesc : "(GMT+03:00) Tbilisi"
},
{
tZCode : "Iran Standard Time",
tZDesc : "(GMT+03:30) Tehran"
},
{
tZCode : "Arabian Standard Time",
tZDesc : "(GMT+04:00) Abu Dhabi, Muscat"
},
{
tZCode : "Azerbaijan Standard Time",
tZDesc : "(GMT+04:00) Baku"
},
{
tZCode : "Mauritius Standard Time",
tZDesc : "(GMT+04:00) Port Louis"
},
{
tZCode : "Caucasus Standard Time",
tZDesc : "(GMT+04:00) Yerevan"
},
{
tZCode : "Afghanistan Standard Time",
tZDesc : "(GMT+04:30) Kabul"
},
{
tZCode : "Ekaterinburg Standard Time",
tZDesc : "(GMT+05:00) Ekaterinburg"
},
{
tZCode : "Pakistan Standard Time",
tZDesc : "(GMT+05:00) Islamabad, Karachi"
},
{
tZCode : "West Asia Standard Time",
tZDesc : "(GMT+05:00) Tashkent"
},
{
tZCode : "India Standard Time",
tZDesc : "(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi"
},
{
tZCode : "Sri Lanka Standard Time",
tZDesc : "(GMT+05:30) Sri Jayawardenepura"
},
{
tZCode : "Nepal Standard Time",
tZDesc : "(GMT+05:45) Kathmandu"
},
{
tZCode : "N. Central Asia Standard Time",
tZDesc : "(GMT+06:00) Almaty, Novosibirsk"
},
{
tZCode : "Central Asia Standard Time",
tZDesc : "(GMT+06:00) Astana, Dhaka"
},
{
tZCode : "Myanmar Standard Time",
tZDesc : "(GMT+06:30) Yangon (Rangoon)"
},
{
tZCode : "SE Asia Standard Time",
tZDesc : "(GMT+07:00) Bangkok, Hanoi, Jakarta"
},
{
tZCode : "North Asia Standard Time",
tZDesc : "(GMT+07:00) Krasnoyarsk"
},
{
tZCode : "China Standard Time",
tZDesc : "(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi"
},
{
tZCode : "North Asia East Standard Time",
tZDesc : "(GMT+08:00) Irkutsk, Ulaan Bataar"
},
{
tZCode : "Singapore Standard Time",
tZDesc : "(GMT+08:00) Kuala Lumpur, Singapore"
},
{
tZCode : "W. Australia Standard Time",
tZDesc : "(GMT+08:00) Perth"
},
{
tZCode : "Taipei Standard Time",
tZDesc : "(GMT+08:00) Taipei"
},
{
tZCode : "Tokyo Standard Time",
tZDesc : "(GMT+09:00) Osaka, Sapporo, Tokyo"
},
{
tZCode : "Korea Standard Time",
tZDesc : "(GMT+09:00) Seoul"
},
{
tZCode : "Yakutsk Standard Time",
tZDesc : "(GMT+09:00) Yakutsk"
},
{
tZCode : "Cen. Australia Standard Time",
tZDesc : "(GMT+09:30) Adelaide"
},
{
tZCode : "AUS Central Standard Time",
tZDesc : "(GMT+09:30) Darwin"
},
{
tZCode : "E. Australia Standard Time",
tZDesc : "(GMT+10:00) Brisbane"
},
{
tZCode : "AUS Eastern Standard Time",
tZDesc : "(GMT+10:00) Canberra, Melbourne, Sydney"
},
{
tZCode : "West Pacific Standard Time",
tZDesc : "(GMT+10:00) Guam, Port Moresby"
},
{
tZCode : "Tasmania Standard Time",
tZDesc : "(GMT+10:00) Hobart"
},
{
tZCode : "Vladivostok Standard Time",
tZDesc : "(GMT+10:00) Vladivostok"
},
{
tZCode : "Central Pacific Standard Time",
tZDesc : "(GMT+11:00) Magadan, Solomon Is., New Caledonia"
},
{
tZCode : "New Zealand Standard Time",
tZDesc : "(GMT+12:00) Auckland, Wellington"
},
{
tZCode : "Fiji Standard Time",
tZDesc : "(GMT+12:00) Fiji, Kamchatka, Marshall Is."
},
{
tZCode : "Tonga Standard Time",
tZDesc : "(GMT+13:00) Nuku'alofa"
},
{
tZCode : "Azores Standard Time",
tZDesc : "(GMT-01:00) Azores"
},
{
tZCode : "Cape Verde Standard Time",
tZDesc : "(GMT-01:00) Cape Verde Is."
},
{
tZCode : "Mid-Atlantic Standard Time",
tZDesc : "(GMT-02:00) Mid-Atlantic"
},
{
tZCode : "E. South America Standard Time",
tZDesc : "(GMT-03:00) Brasilia"
},
{
tZCode : "Argentina Standard Time",
tZDesc : "(GMT-03:00) Buenos Aires"
},
{
tZCode : "SA Eastern Standard Time",
tZDesc : "(GMT-03:00) Georgetown"
},
{
tZCode : "Greenland Standard Time",
tZDesc : "(GMT-03:00) Greenland"
},
{
tZCode : "Montevideo Standard Time",
tZDesc : "(GMT-03:00) Montevideo"
},
{
tZCode : "Newfoundland Standard Time",
tZDesc : "(GMT-03:30) Newfoundland"
},
{
tZCode : "Atlantic Standard Time",
tZDesc : "(GMT-04:00) Atlantic Time (Canada)"
},
{
tZCode : "SA Western Standard Time",
tZDesc : "(GMT-04:00) La Paz"
},
{
tZCode : "Central Brazilian Standard Time",
tZDesc : "(GMT-04:00) Manaus"
},
{
tZCode : "Pacific SA Standard Time",
tZDesc : "(GMT-04:00) Santiago"
},
{
tZCode : "Venezuela Standard Time",
tZDesc : "(GMT-04:30) Caracas"
},
{
tZCode : "SA Pacific Standard Time",
tZDesc : "(GMT-05:00) Bogota, Lima, Quito, Rio Branco"
},
{
tZCode : "Eastern Standard Time",
tZDesc : "(GMT-05:00) Eastern Time (US & Canada)"
},
{
tZCode : "US Eastern Standard Time",
tZDesc : "(GMT-05:00) Indiana (East)"
},
{
tZCode : "Central America Standard Time",
tZDesc : "(GMT-06:00) Central America"
},
{
tZCode : "Central Standard Time",
tZDesc : "(GMT-06:00) Central Time (US & Canada)"
},
{
tZCode : "Central Standard Time (Mexico)",
tZDesc : "(GMT-06:00) Guadalajara, Mexico City, Monterrey"
},
{
tZCode : "Canada Central Standard Time",
tZDesc : "(GMT-06:00) Saskatchewan"
},
{
tZCode : "US Mountain Standard Time",
tZDesc : "(GMT-07:00) Arizona"
},
{
tZCode : "Mountain Standard Time (Mexico)",
tZDesc : "(GMT-07:00) Chihuahua, La Paz, Mazatlan"
},
{
tZCode : "Mountain Standard Time",
tZDesc : "(GMT-07:00) Mountain Time (US & Canada)"
},
{
tZCode : "Pacific Standard Time",
tZDesc : "(GMT-08:00) Pacific Time (US & Canada)"
},
{
tZCode : "Pacific Standard Time (Mexico)",
tZDesc : "(GMT-08:00) Tijuana, Baja California"
},
{
tZCode : "Alaskan Standard Time",
tZDesc : "(GMT-09:00) Alaska"
},
{
tZCode : "Hawaiian Standard Time",
tZDesc : "(GMT-10:00) Hawaii"
},
{
tZCode : "Samoa Standard Time",
tZDesc : "(GMT-11:00) Midway Island, Samoa"
},
{
tZCode : "Dateline Standard Time",
tZDesc : "(GMT-12:00) International Date Line West"
}
Windwos 时区国家关系
对应关系列表
/*
Dateline Standard Time,(GMT-12:00)日界线西,国际日期变更线标准时间
Samoa Standard Time,(GMT-11:00) 中途岛,萨摩亚群岛,萨摩亚群岛标准时间
Hawaiian Standard Time,(GMT-10:00) 夏威夷,夏威夷标准时间
Alaskan Standard Time,(GMT-09:00) 阿拉斯加,阿拉斯加标准时间
Pacific Standard Time,(GMT-08:00) 太平洋时间(美国和加拿大);蒂华纳,太平洋标准时间
US Mountain Standard Time,(GMT-07:00) 亚利桑那,美国山地标准时间
Mountain Standard Time,(GMT-07:00) 山地时间(美国和加拿大),山地标准时间
Mexico Standard Time 2,(GMT-07:00)奇瓦瓦,拉巴斯,马扎特兰,墨西哥标准时间 2
Central America Standard Time,(GMT-06:00) 中美洲,中美洲标准时间
Central Standard Time,(GMT-06:00) 中部时间(美国和加拿大),中部标准时间
Canada Central Standard Time,(GMT-06:00) 萨斯喀彻温,加拿大中部标准时间
Mexico Standard Time,(GMT-06:00)瓜达拉哈拉,墨西哥城,蒙特雷,墨西哥标准时间
Eastern Standard Time,(GMT-05:00) 东部时间(美国和加拿大),东部标准时间
US Eastern Standard Time,(GMT-05:00) 印地安那州(东部),美国东部标准时间
SA Pacific Standard Time,(GMT-05:00) 波哥大,利马,基多,南美州太平洋标准时间
SA Western Standard Time,(GMT-04:00) 加拉加斯,拉巴斯,南美州西部标准时间
Pacific SA Standard Time,(GMT-04:00) 圣地亚哥,南美州太平洋标准时间
Atlantic Standard Time,(GMT-04:00) 大西洋时间(加拿大),大西洋标准时间
Newfoundland Standard Time,(GMT-03:30) 纽芬兰,纽芬兰标准时间
E. South America Standard Time,(GMT-03:00) 巴西利亚,南美州东部标准时间
SA Eastern Standard Time,(GMT-03:00) 布宜诺斯艾利斯,乔治敦,南美州东部标准时间
Greenland Standard Time,(GMT-03:00) 格陵兰,格陵兰东部标准时间
Mid-Atlantic Standard Time,(GMT-02:00) 中大西洋,中大西洋标准时间
Azores Standard Time,(GMT-01:00) 亚速尔群岛,亚速尔群岛标准时间
Cape Verde Standard Time,(GMT-01:00) 佛得角群岛,佛得角群岛标准时间
Greenwich Standard Time,(GMT) 卡萨布兰卡,蒙罗维亚,格林威治标准时间
GMT Standard Time,(GMT) 格林威治标准时间: 都柏林, 爱丁堡, 伦敦, 里斯本,格林威治标准时间
W. Central Africa Standard Time,(GMT+01:00) 中非西部,中非西部标准时间
Romance Standard Time,(GMT+01:00) 布鲁塞尔,哥本哈根,马德里,巴黎,罗马标准时间
Central European Standard Time,(GMT+01:00) 萨拉热窝,斯科普里,华沙,萨格勒布,中欧标准时间
Central Europe Standard Time,(GMT+01:00) 贝尔格莱德,布拉迪斯拉发,布达佩斯,卢布尔雅那,布拉格,中欧标准时间
W. Europe Standard Time,(GMT+01:00) 阿姆斯特丹,柏林,伯尔尼,罗马,斯德哥尔摩,维也纳,西欧标准时间
South Africa Standard Time,(GMT+02:00) 哈拉雷,比勒陀利亚,南非标准时间
E. Europe Standard Time,(GMT+02:00) 布加勒斯特,东欧标准时间
Egypt Standard Time,(GMT+02:00) 开罗,埃及标准时间
Israel Standard Time,(GMT+02:00) 耶路撒冷,耶路撒冷标准时间
FLE Standard Time,(GMT+02:00) 赫尔辛基,基辅,里加,索非亚,塔林,维尔纽斯,FLE 标准时间
GTB Standard Time,(GMT+02:00) 雅典,贝鲁特,伊斯坦布尔,明斯克,GTB 标准时间
E. Africa Standard Time,(GMT+03:00) 内罗毕,东非标准时间
Arabic Standard Time,(GMT+03:00) 巴格达,阿拉伯标准时间
Arab Standard Time,(GMT+03:00) 科威特,利雅得,阿拉伯标准时间
Russian Standard Time,(GMT+03:00) 莫斯科,圣彼得堡, 伏尔加格勒,俄罗斯标准时间
Iran Standard Time,(GMT+03:30) 德黑兰,伊朗标准时间
Caucasus Standard Time,(GMT+04:00) 巴库,第比利斯,埃里温,高加索标准时间
Arabian Standard Time,(GMT+04:00) 阿布扎比,马斯喀特,阿拉伯半岛标准时间
Afghanistan Standard Time,(GMT+04:30) 喀布尔,阿富汗标准时间
West Asia Standard Time,(GMT+05:00) 伊斯兰堡,卡拉奇,塔什干,西亚标准时间
Ekaterinburg Standard Time,(GMT+05:00) 叶卡捷琳堡,叶卡捷琳堡标准时间
India Standard Time,(GMT+05:30) 马德拉斯,加尔各答,孟买,新德里,印度标准时间
Nepal Standard Time,(GMT+05:45) 加德满都,尼泊尔标准时间
Sri Lanka Standard Time,(GMT+06:00) 斯里哈亚华登尼普拉,斯里兰卡标准时间
N. Central Asia Standard Time,(GMT+06:00) 阿拉木图,新西伯利亚,中亚北部标准时间
Central Asia Standard Time,(GMT+06:00) 阿斯塔纳,达卡,中亚标准时间
Myanmar Standard Time,(GMT+06:30) 仰光,缅甸标准时间
North Asia Standard Time,(GMT+07:00) 克拉斯诺亚尔斯克,北亚标准时间
SE Asia Standard Time,(GMT+07:00) 曼谷,河内,雅加达,东南亚标准时间
North Asia East Standard Time,(GMT+08:00) 伊尔库茨克,乌兰巴图,北亚东部标准时间
China Standard Time,(GMT+08:00) 北京,重庆,香港特别行政区,乌鲁木齐,中国标准时间
Taipei Standard Time,(GMT+08:00) 台北,台北标准时间
Singapore Standard Time,(GMT+08:00) 吉隆坡,新加坡,马来西亚半岛标准时间
W. Australia Standard Time,(GMT+08:00) 珀斯,澳大利亚西部标准时间
Tokyo Standard Time,(GMT+09:00) 大坂,札幌,东京,东京标准时间
Korea Standard Time,(GMT+09:00) 汉城,韩国标准时间
Yakutsk Standard Time,(GMT+09:00) 雅库茨克,雅库茨克标准时间
AUS Central Standard Time,(GMT+09:30) 达尔文,澳大利亚中部标准时间
Cen. Australia Standard Time,(GMT+09:30) 阿德莱德,澳大利亚中部标准时间
West Pacific Standard Time,(GMT+10:00) 关岛,莫尔兹比港,西太平洋标准时间
AUS Eastern Standard Time,(GMT+10:00) 堪培拉,墨尔本,悉尼,澳大利亚东部标准时间
E. Australia Standard Time,(GMT+10:00) 布里斯班,澳大利亚东部标准时间
Vladivostok Standard Time,(GMT+10:00) 符拉迪沃斯托克,符拉迪沃斯托克标准时间
Tasmania Standard Time,(GMT+10:00) 霍巴特,塔斯马尼亚岛标准时间
Central Pacific Standard Time,(GMT+11:00) 马加丹,索罗门群岛,新喀里多尼亚,太平洋中部标准时间
New Zealand Standard Time,(GMT+12:00) 奥克兰,惠灵顿,新西兰标准时间
Fiji Standard Time,(GMT+12:00) 斐济,堪察加半岛,马绍尔群岛,斐济标准时间
Tonga Standard Time,(GMT+13:00) 努库阿洛法,汤加标准时间
*/
获取服务器Olson时区
var x = NodaTime.DateTimeZoneProviders.Tzdb.GetSystemDefault();
Console.WriteLine(x);
获取全部Olson时区
代码
using NodaTime.TimeZones;
using NodaTime.Extensions;
//第一种
foreach (var item in TzdbDateTimeZoneSource.Default.ZoneLocations.ToList())
{
Console.WriteLine($"{item.ZoneId} ({item.CountryName})");
}
//第二种
var list2 = NodaTime.DateTimeZoneProviders.Tzdb.Ids;
//第三种
var list3 = NodaTime.DateTimeZoneProviders.Tzdb.GetAllZones().ToList();
时区列表
var olsonWindowsTimes = new Dictionary<string, string>()
{
{ "Africa/Bangui", "W. Central Africa Standard Time" },
{ "Africa/Cairo", "Egypt Standard Time" },
{ "Africa/Casablanca", "Morocco Standard Time" },
{ "Africa/Harare", "South Africa Standard Time" },
{ "Africa/Johannesburg", "South Africa Standard Time" },
{ "Africa/Lagos", "W. Central Africa Standard Time" },
{ "Africa/Monrovia", "Greenwich Standard Time" },
{ "Africa/Nairobi", "E. Africa Standard Time" },
{ "Africa/Windhoek", "Namibia Standard Time" },
{ "America/Anchorage", "Alaskan Standard Time" },
{ "America/Argentina/San_Juan", "Argentina Standard Time" },
{ "America/Asuncion", "Paraguay Standard Time" },
{ "America/Bahia", "Bahia Standard Time" },
{ "America/Bogota", "SA Pacific Standard Time" },
{ "America/Buenos_Aires", "Argentina Standard Time" },
{ "America/Caracas", "Venezuela Standard Time" },
{ "America/Cayenne", "SA Eastern Standard Time" },
{ "America/Chicago", "Central Standard Time" },
{ "America/Chihuahua", "Mountain Standard Time (Mexico)" },
{ "America/Cuiaba", "Central Brazilian Standard Time" },
{ "America/Denver", "Mountain Standard Time" },
{ "America/Fortaleza", "SA Eastern Standard Time" },
{ "America/Godthab", "Greenland Standard Time" },
{ "America/Guatemala", "Central America Standard Time" },
{ "America/Halifax", "Atlantic Standard Time" },
{ "America/Indianapolis", "US Eastern Standard Time" },
{ "America/Indiana/Indianapolis", "US Eastern Standard Time" },
{ "America/La_Paz", "SA Western Standard Time" },
{ "America/Los_Angeles", "Pacific Standard Time" },
{ "America/Mexico_City", "Mexico Standard Time" },
{ "America/Montevideo", "Montevideo Standard Time" },
{ "America/New_York", "Eastern Standard Time" },
{ "America/Noronha", "UTC-02" },
{ "America/Phoenix", "US Mountain Standard Time" },
{ "America/Regina", "Canada Central Standard Time" },
{ "America/Santa_Isabel", "Pacific Standard Time (Mexico)" },
{ "America/Santiago", "Pacific SA Standard Time" },
{ "America/Sao_Paulo", "E. South America Standard Time" },
{ "America/St_Johns", "Newfoundland Standard Time" },
{ "America/Tijuana", "Pacific Standard Time" },
{ "Antarctica/McMurdo", "New Zealand Standard Time" },
{ "Atlantic/South_Georgia", "UTC-02" },
{ "Asia/Almaty", "Central Asia Standard Time" },
{ "Asia/Amman", "Jordan Standard Time" },
{ "Asia/Baghdad", "Arabic Standard Time" },
{ "Asia/Baku", "Azerbaijan Standard Time" },
{ "Asia/Bangkok", "SE Asia Standard Time" },
{ "Asia/Beirut", "Middle East Standard Time" },
{ "Asia/Calcutta", "India Standard Time" },
{ "Asia/Colombo", "Sri Lanka Standard Time" },
{ "Asia/Damascus", "Syria Standard Time" },
{ "Asia/Dhaka", "Bangladesh Standard Time" },
{ "Asia/Dubai", "Arabian Standard Time" },
{ "Asia/Irkutsk", "North Asia East Standard Time" },
{ "Asia/Jerusalem", "Israel Standard Time" },
{ "Asia/Kabul", "Afghanistan Standard Time" },
{ "Asia/Kamchatka", "Kamchatka Standard Time" },
{ "Asia/Karachi", "Pakistan Standard Time" },
{ "Asia/Katmandu", "Nepal Standard Time" },
{ "Asia/Kolkata", "India Standard Time" },
{ "Asia/Krasnoyarsk", "North Asia Standard Time" },
{ "Asia/Kuala_Lumpur", "Singapore Standard Time" },
{ "Asia/Kuwait", "Arab Standard Time" },
{ "Asia/Magadan", "Magadan Standard Time" },
{ "Asia/Muscat", "Arabian Standard Time" },
{ "Asia/Novosibirsk", "N. Central Asia Standard Time" },
{ "Asia/Oral", "West Asia Standard Time" },
{ "Asia/Rangoon", "Myanmar Standard Time" },
{ "Asia/Riyadh", "Arab Standard Time" },
{ "Asia/Seoul", "Korea Standard Time" },
{ "Asia/Shanghai", "China Standard Time" },
{ "Asia/Singapore", "Singapore Standard Time" },
{ "Asia/Taipei", "Taipei Standard Time" },
{ "Asia/Tashkent", "West Asia Standard Time" },
{ "Asia/Tbilisi", "Georgian Standard Time" },
{ "Asia/Tehran", "Iran Standard Time" },
{ "Asia/Tokyo", "Tokyo Standard Time" },
{ "Asia/Ulaanbaatar", "Ulaanbaatar Standard Time" },
{ "Asia/Vladivostok", "Vladivostok Standard Time" },
{ "Asia/Yakutsk", "Yakutsk Standard Time" },
{ "Asia/Yekaterinburg", "Ekaterinburg Standard Time" },
{ "Asia/Yerevan", "Armenian Standard Time" },
{ "Atlantic/Azores", "Azores Standard Time" },
{ "Atlantic/Cape_Verde", "Cape Verde Standard Time" },
{ "Atlantic/Reykjavik", "Greenwich Standard Time" },
{ "Australia/Adelaide", "Cen. Australia Standard Time" },
{ "Australia/Brisbane", "E. Australia Standard Time" },
{ "Australia/Darwin", "AUS Central Standard Time" },
{ "Australia/Hobart", "Tasmania Standard Time" },
{ "Australia/Perth", "W. Australia Standard Time" },
{ "Australia/Sydney", "AUS Eastern Standard Time" },
{ "Etc/GMT", "UTC" },
{ "Etc/GMT+11", "UTC-11" },
{ "Etc/GMT+12", "Dateline Standard Time" },
{ "Etc/GMT+2", "UTC-02" },
{ "Etc/GMT-12", "UTC+12" },
{ "Europe/Amsterdam", "W. Europe Standard Time" },
{ "Europe/Athens", "GTB Standard Time" },
{ "Europe/Belgrade", "Central Europe Standard Time" },
{ "Europe/Berlin", "W. Europe Standard Time" },
{ "Europe/Brussels", "Romance Standard Time" },
{ "Europe/Budapest", "Central Europe Standard Time" },
{ "Europe/Dublin", "GMT Standard Time" },
{ "Europe/Helsinki", "FLE Standard Time" },
{ "Europe/Istanbul", "GTB Standard Time" },
{ "Europe/Kiev", "FLE Standard Time" },
{ "Europe/London", "GMT Standard Time" },
{ "Europe/Minsk", "E. Europe Standard Time" },
{ "Europe/Moscow", "Russian Standard Time" },
{ "Europe/Paris", "Romance Standard Time" },
{ "Europe/Sarajevo", "Central European Standard Time" },
{ "Europe/Warsaw", "Central European Standard Time" },
{ "Indian/Mauritius", "Mauritius Standard Time" },
{ "Pacific/Apia", "Samoa Standard Time" },
{ "Pacific/Auckland", "New Zealand Standard Time" },
{ "Pacific/Fiji", "Fiji Standard Time" },
{ "Pacific/Guadalcanal", "Central Pacific Standard Time" },
{ "Pacific/Guam", "West Pacific Standard Time" },
{ "Pacific/Honolulu", "Hawaiian Standard Time" },
{ "Pacific/Pago_Pago", "UTC-11" },
{ "Pacific/Port_Moresby", "West Pacific Standard Time" },
{ "Pacific/Tongatapu", "Tonga Standard Time" }
};
sqlserver 存储时间
推荐 sqlserver 中使用:datetime2。
- date:3字节,表示范围:0001-01-01 到 9999-12-31
- datetime:8字节,表示范围: 1753-01-01 00:00:00 到 9999-12-31 23:59:59
- datetime2:6-8个字节,表示范围:0001-01-01 00:00:00 到 9999-12-31 23:59:59.9999999
- smalldatetime:4个字节,表示范围:1900-01-01 00:00:00 到 2079-06-06 23:59:59
- time:5个字节,表示范围: 00:00:00.0000000 到 23:59:59.9999999
- datetimeoffset:10个字节,表示范围:0001-01-01 00:00:00 到 23:59:59.9999999,可表示时区