也許未來其他公司還會用到 姑且保留一份
99開頭的是負數、77開頭的是正數
用很草率的方式轉出來的
var qqqqqqq = TimeZoneInfo.GetSystemTimeZones();
var allTimeZone = qqqqqqq.Select(x => new
{
DisplayName = x.DisplayName,
timeZone = x.BaseUtcOffset.TotalHours,
areaEN = x.Id.Replace(" Standard Time" , "")
.Replace(" " , "")
.Replace("_" , "")
.Replace("0", "")
.Replace("-", "")
.Replace("(", "")
.Replace(")", "")
.Replace("." , "")
.Replace("+", "")
})
.ToList();
int sequence = 0;
string concatText = "";
double lastTimeZone = allTimeZone.FirstOrDefault().timeZone;
foreach (var item in allTimeZone)
{
if(lastTimeZone != item.timeZone)
{
lastTimeZone = item.timeZone;
sequence = 0;
}
sequence++;
string minus = item.timeZone < 0 ? "_minus" : "";
int prefix = item.timeZone < 0 ? 99 : 77;
concatText += string.Format(@"[Description('{0}')] " , item.DisplayName );
string timeZoneAbsValue = (item.timeZone < 0 ? -1 * item.timeZone : item.timeZone).ToString("00.00");
timeZoneAbsValue = timeZoneAbsValue.Replace(".75", ".45").Replace(".50" , ".30");
timeZoneAbsValue = timeZoneAbsValue.Replace("." , "");
concatText += $"{item.areaEN}{minus}_{timeZoneAbsValue} = {prefix}{timeZoneAbsValue}{sequence.ToString("00")} , ";
}
[Description("(UTC-12:00) 國際換日線以西")]
Dateline_minus_1200 = 99120001,
[Description("(UTC-11:00) 國際標準時間-11")]
UTC11_minus_1100 = 99110001,
[Description("(UTC-10:00) 夏威夷")]
Hawaiian_minus_1000 = 99100001,
[Description("(UTC-10:00) 阿留申群島")]
Aleutian_minus_1000 = 99100002,
[Description("(UTC-09:30) 馬克沙斯群島")]
Marquesas_minus_0930 = 99093001,
[Description("(UTC-09:00) 國際標準時間-09")]
UTC9_minus_0900 = 99090001,
[Description("(UTC-09:00) 阿拉斯加")]
Alaskan_minus_0900 = 99090002,
[Description("(UTC-08:00) 下加利福尼亞")]
PacificMexico_minus_0800 = 99080001,
[Description("(UTC-08:00) 國際標準時間-08")]
UTC8_minus_0800 = 99080002,
[Description("(UTC-08:00) 太平洋時間 (美國和加拿大)")]
Pacific_minus_0800 = 99080003,
[Description("(UTC-07:00) 亞歷桑那")]
USMountain_minus_0700 = 99070001,
[Description("(UTC-07:00) 山區時間 (美國和加拿大)")]
Mountain_minus_0700 = 99070002,
[Description("(UTC-07:00) 齊驊華,拉帕茲,馬札特蘭")]
MountainMexico_minus_0700 = 99070003,
[Description("(UTC-06:00) 中美洲")]
CentralAmerica_minus_0600 = 99060001,
[Description("(UTC-06:00) 中部時間 (美國和加拿大)")]
Central_minus_0600 = 99060002,
[Description("(UTC-06:00) 伊斯特島")]
EasterIsland_minus_0600 = 99060003,
[Description("(UTC-06:00) 瓜達拉加若,墨西哥城,蒙特利")]
CentralMexico_minus_0600 = 99060004,
[Description("(UTC-06:00) 薩克其萬 (加拿大)")]
CanadaCentral_minus_0600 = 99060005,
[Description("(UTC-05:00) 切圖馬爾")]
EasternMexico_minus_0500 = 99050001,
[Description("(UTC-05:00) 印第安納 (東部)")]
USEastern_minus_0500 = 99050002,
[Description("(UTC-05:00) 哈瓦那")]
Cuba_minus_0500 = 99050003,
[Description("(UTC-05:00) 土克斯及開科斯")]
TurksAndCaicos_minus_0500 = 99050004,
[Description("(UTC-05:00) 東部時間 (美國和加拿大)")]
Eastern_minus_0500 = 99050005,
[Description("(UTC-05:00) 波哥大,利馬,基多,里約布蘭科")]
SAPacific_minus_0500 = 99050006,
[Description("(UTC-05:00) 海地")]
Haiti_minus_0500 = 99050007,
[Description("(UTC-04:00) 亞松森")]
Paraguay_minus_0400 = 99040001,
[Description("(UTC-04:00) 佐治敦,拉帕茲,瑪瑙斯,聖胡安")]
SAWestern_minus_0400 = 99040002,
[Description("(UTC-04:00) 卡拉卡斯")]
Venezuela_minus_0400 = 99040003,
[Description("(UTC-04:00) 古雅巴")]
CentralBrazilian_minus_0400 = 99040004,
[Description("(UTC-04:00) 大西洋時間 (加拿大)")]
Atlantic_minus_0400 = 99040005,
[Description("(UTC-04:00) 聖地牙哥")]
PacificSA_minus_0400 = 99040006,
[Description("(UTC-03:30) 紐芬蘭")]
Newfoundland_minus_0330 = 99033001,
[Description("(UTC-03:00) 巴西利亞")]
ESouthAmerica_minus_0300 = 99030001,
[Description("(UTC-03:00) 布宜諾斯艾利斯")]
Argentina_minus_0300 = 99030002,
[Description("(UTC-03:00) 格陵蘭")]
Greenland_minus_0300 = 99030003,
[Description("(UTC-03:00) 聖匹島")]
SaintPierre_minus_0300 = 99030004,
[Description("(UTC-03:00) 蒙特維多")]
Montevideo_minus_0300 = 99030005,
[Description("(UTC-03:00) 蓬塔阿雷納斯")]
Magallanes_minus_0300 = 99030006,
[Description("(UTC-03:00) 薩爾瓦多")]
Bahia_minus_0300 = 99030007,
[Description("(UTC-03:00) 開雲,福塔力沙")]
SAEastern_minus_0300 = 99030008,
[Description("(UTC-03:00) 阿拉瓜伊納")]
Tocantins_minus_0300 = 99030009,
[Description("(UTC-02:00) 國際標準時間-02")]
UTC2_minus_0200 = 99020001,
[Description("(UTC-02:00) 大西洋中部 - 已過時")]
MidAtlantic_minus_0200 = 99020002,
[Description("(UTC-01:00) 亞速爾群島")]
Azores_minus_0100 = 99010001,
[Description("(UTC-01:00) 維德角")]
CapeVerde_minus_0100 = 99010002,
[Description("(UTC) Coordinated Universal Time")]
UTC_0000 = 77000001,
[Description("(UTC+00:00) 聖多美普林西比")]
SaoTome_0000 = 77000002,
[Description("(UTC+00:00) 蒙羅維亞,雷克雅維克")]
Greenwich_0000 = 77000003,
[Description("(UTC+00:00) 都柏林,愛丁堡,里斯本,倫敦")]
GMT_0000 = 77000004,
[Description("(UTC+01:00) 卡薩布蘭卡")]
Morocco_0000 = 77000005,
[Description("(UTC+01:00) 中西非")]
WCentralAfrica_0100 = 77010001,
[Description("(UTC+01:00) 塞拉耶佛,斯高彼亞,華沙,札格雷布")]
CentralEuropean_0100 = 77010002,
[Description("(UTC+01:00) 布魯塞爾,哥本哈根,馬德里,巴黎")]
Romance_0100 = 77010003,
[Description("(UTC+01:00) 貝爾格勒,布拉提斯拉瓦,布達佩斯,盧布亞納,布拉格")]
CentralEurope_0100 = 77010004,
[Description("(UTC+01:00) 阿姆斯特丹,柏林,伯恩,羅馬,斯德哥爾摩,維也納")]
WEurope_0100 = 77010005,
[Description("(UTC+02:00) 加薩,希伯侖")]
WestBank_0200 = 77020001,
[Description("(UTC+02:00) 卡里寧格勒")]
Kaliningrad_0200 = 77020002,
[Description("(UTC+02:00) 哈拉雷,皮托里")]
SouthAfrica_0200 = 77020003,
[Description("(UTC+02:00) 喀土穆")]
Sudan_0200 = 77020004,
[Description("(UTC+02:00) 大馬士革")]
Syria_0200 = 77020005,
[Description("(UTC+02:00) 奇西瑙")]
EEurope_0200 = 77020006,
[Description("(UTC+02:00) 安曼")]
Jordan_0200 = 77020007,
[Description("(UTC+02:00) 溫吐克")]
Namibia_0200 = 77020008,
[Description("(UTC+02:00) 的黎波里")]
Libya_0200 = 77020009,
[Description("(UTC+02:00) 耶路撒冷")]
Israel_0200 = 77020010,
[Description("(UTC+02:00) 貝魯特")]
MiddleEast_0200 = 77020011,
[Description("(UTC+02:00) 赫爾辛基,凱耶夫,里加,蘇非亞,塔林,維爾紐斯")]
FLE_0200 = 77020012,
[Description("(UTC+02:00) 開羅")]
Egypt_0200 = 77020013,
[Description("(UTC+02:00) 雅典,布加勒斯特")]
GTB_0200 = 77020014,
[Description("(UTC+03:00) 伊斯坦堡")]
Turkey_0300 = 77030001,
[Description("(UTC+03:00) 奈洛比")]
EAfrica_0300 = 77030002,
[Description("(UTC+03:00) 巴格達")]
Arabic_0300 = 77030003,
[Description("(UTC+03:00) 明斯克")]
Belarus_0300 = 77030004,
[Description("(UTC+03:00) 科威特,利雅德")]
Arab_0300 = 77030005,
[Description("(UTC+03:00) 莫斯科,聖彼得堡")]
Russian_0300 = 77030006,
[Description("(UTC+03:30) 德黑蘭")]
Iran_0330 = 77033001,
[Description("(UTC+04:00) 伊熱夫斯克,沙馬拉")]
RussiaTimeZone3_0400 = 77040001,
[Description("(UTC+04:00) 伏爾加格勒")]
Volgograd_0400 = 77040002,
[Description("(UTC+04:00) 巴庫")]
Azerbaijan_0400 = 77040003,
[Description("(UTC+04:00) 第比利斯")]
Georgian_0400 = 77040004,
[Description("(UTC+04:00) 葉里溫")]
Caucasus_0400 = 77040005,
[Description("(UTC+04:00) 薩拉托夫")]
Saratov_0400 = 77040006,
[Description("(UTC+04:00) 路易士港")]
Mauritius_0400 = 77040007,
[Description("(UTC+04:00) 阿布達比,馬斯喀特")]
Arabian_0400 = 77040008,
[Description("(UTC+04:00) 阿斯特拉罕,烏里揚諾夫斯克")]
Astrakhan_0400 = 77040009,
[Description("(UTC+04:30) 喀布爾")]
Afghanistan_0430 = 77043001,
[Description("(UTC+05:00) 伊卡特林堡")]
Ekaterinburg_0500 = 77050001,
[Description("(UTC+05:00) 伊斯蘭馬巴德,克洛奇")]
Pakistan_0500 = 77050002,
[Description("(UTC+05:00) 克孜勒奧爾達")]
Qyzylorda_0500 = 77050003,
[Description("(UTC+05:00) 阿什哈巴德,塔什干")]
WestAsia_0500 = 77050004,
[Description("(UTC+05:30) 斯里哈亞華登尼普拉")]
SriLanka_0530 = 77053001,
[Description("(UTC+05:30) 辰內,加爾各答,孟拜,新德里")]
India_0530 = 77053002,
[Description("(UTC+05:45) 加德滿都")]
Nepal_0545 = 77054501,
[Description("(UTC+06:00) 達卡")]
Bangladesh_0600 = 77060001,
[Description("(UTC+06:00) 鄂木斯克")]
Omsk_0600 = 77060002,
[Description("(UTC+06:00) 阿斯坦納")]
CentralAsia_0600 = 77060003,
[Description("(UTC+06:30) 仰光")]
Myanmar_0630 = 77063001,
[Description("(UTC+07:00) 克拉斯諾亞爾斯克")]
NorthAsia_0700 = 77070001,
[Description("(UTC+07:00) 哈霍德")]
WMongolia_0700 = 77070002,
[Description("(UTC+07:00) 巴爾瑙爾,戈爾諾-阿爾泰斯克")]
Altai_0700 = 77070003,
[Description("(UTC+07:00) 托木斯克")]
Tomsk_0700 = 77070004,
[Description("(UTC+07:00) 新西伯利亞")]
NCentralAsia_0700 = 77070005,
[Description("(UTC+07:00) 曼谷,河內,雅加達")]
SEAsia_0700 = 77070006,
[Description("(UTC+08:00) 伊爾庫次克")]
NorthAsiaEast_0800 = 77080001,
[Description("(UTC+08:00) 伯斯")]
WAustralia_0800 = 77080002,
[Description("(UTC+08:00) 北京,重慶,香港特別行政區,烏魯木齊")]
China_0800 = 77080003,
[Description("(UTC+08:00) 台北")]
Taipei_0800 = 77080004,
[Description("(UTC+08:00) 吉隆坡,新加坡")]
Singapore_0800 = 77080005,
[Description("(UTC+08:00) 庫倫")]
Ulaanbaatar_0800 = 77080006,
[Description("(UTC+08:45) 尤克拉")]
AusCentralW_0845 = 77084501,
[Description("(UTC+09:00) 亞庫茲克")]
Yakutsk_0900 = 77090001,
[Description("(UTC+09:00) 大阪,北海道,東京")]
Tokyo_0900 = 77090002,
[Description("(UTC+09:00) 平壤")]
NorthKorea_0900 = 77090003,
[Description("(UTC+09:00) 赤塔")]
Transbaikal_0900 = 77090004,
[Description("(UTC+09:00) 首爾")]
Korea_0900 = 77090005,
[Description("(UTC+09:30) 愛德蘭")]
CenAustralia_0930 = 77093001,
[Description("(UTC+09:30) 達爾文")]
AUSCentral_0930 = 77093002,
[Description("(UTC+10:00) 坎培拉,墨爾本,雪梨")]
AUSEastern_1000 = 77100001,
[Description("(UTC+10:00) 布里斯本")]
EAustralia_1000 = 77100002,
[Description("(UTC+10:00) 海參威")]
Vladivostok_1000 = 77100003,
[Description("(UTC+10:00) 關島,莫爾斯貝港")]
WestPacific_1000 = 77100004,
[Description("(UTC+10:00) 霍巴特")]
Tasmania_1000 = 77100005,
[Description("(UTC+10:30) 羅豪島")]
LordHowe_1030 = 77103001,
[Description("(UTC+11:00) 喬庫爾達赫")]
RussiaTimeZone1_1100 = 77110001,
[Description("(UTC+11:00) 布干維爾島")]
Bougainville_1100 = 77110002,
[Description("(UTC+11:00) 庫頁島")]
Sakhalin_1100 = 77110003,
[Description("(UTC+11:00) 索羅門群島,新喀里多尼亞群島")]
CentralPacific_1100 = 77110004,
[Description("(UTC+11:00) 諾福克島")]
Norfolk_1100 = 77110005,
[Description("(UTC+11:00) 馬加丹")]
Magadan_1100 = 77110006,
[Description("(UTC+12:00) 國際標準時間+12")]
UTC12_1200 = 77120001,
[Description("(UTC+12:00) 奧克蘭,威靈頓")]
NewZealand_1200 = 77120002,
[Description("(UTC+12:00) 彼得保羅夫斯克-堪察加斯克 - 已過時")]
Kamchatka_1200 = 77120003,
[Description("(UTC+12:00) 斐濟")]
Fiji_1200 = 77120004,
[Description("(UTC+12:00) 阿納底,彼得保羅夫斯克-堪察加斯克")]
RussiaTimeZone11_1200 = 77120005,
[Description("(UTC+12:45) 查塔姆群島")]
ChathamIslands_1245 = 77124501,
[Description("(UTC+13:00) 努瓜婁發")]
Tonga_1300 = 77130001,
[Description("(UTC+13:00) 國際標準時間+13")]
UTC13_1300 = 77130002,
[Description("(UTC+13:00) 薩摩亞")]
Samoa_1300 = 77130003,
[Description("(UTC+14:00) 刻里提瑪斯島")]
LineIslands_1400 = 77140001,