Where can I get a list of abbreviations for timeZo

2020-05-20 07:52发布

I'd like to do some timezone calculation, using the following API:

NSTimeZone *some_time_zone = [NSTimeZone timeZoneWithAbbreviation:name];

however, I am not sure where to find the supported list of abbreviation names. For example, what is the name for the timezone of Siena Italy?

标签: iphone
3条回答
孤傲高冷的网名
2楼-- · 2020-05-20 07:55

Try [NSTimeZone abbreviationDictionary] or [NSTimeZone knownTimeZoneNames].

查看更多
成全新的幸福
3楼-- · 2020-05-20 07:58

Swift 3.0:

print("\(NSTimeZone.abbreviationDictionary)")
查看更多
在下西门庆
4楼-- · 2020-05-20 08:02

Code

NSLog(@"timezones: %@", [NSTimeZone abbreviationDictionary]);

Output

timezones: {
    ADT = "America/Halifax";
    AKDT = "America/Juneau";
    AKST = "America/Juneau";
    ART = "America/Argentina/Buenos_Aires";
    AST = "America/Halifax";
    BDT = "Asia/Dhaka";
    BRST = "America/Sao_Paulo";
    BRT = "America/Sao_Paulo";
    BST = "Europe/London";
    CAT = "Africa/Harare";
    CDT = "America/Chicago";
    CEST = "Europe/Paris";
    CET = "Europe/Paris";
    CLST = "America/Santiago";
    CLT = "America/Santiago";
    COT = "America/Bogota";
    CST = "America/Chicago";
    EAT = "Africa/Addis_Ababa";
    EDT = "America/New_York";
    EEST = "Europe/Istanbul";
    EET = "Europe/Istanbul";
    EST = "America/New_York";
    GMT = GMT;
    GST = "Asia/Dubai";
    HKT = "Asia/Hong_Kong";
    HST = "Pacific/Honolulu";
    ICT = "Asia/Bangkok";
    IRST = "Asia/Tehran";
    IST = "Asia/Calcutta";
    JST = "Asia/Tokyo";
    KST = "Asia/Seoul";
    MDT = "America/Denver";
    MSD = "Europe/Moscow";
    MSK = "Europe/Moscow";
    MST = "America/Denver";
    NZDT = "Pacific/Auckland";
    NZST = "Pacific/Auckland";
    PDT = "America/Los_Angeles";
    PET = "America/Lima";
    PHT = "Asia/Manila";
    PKT = "Asia/Karachi";
    PST = "America/Los_Angeles";
    SGT = "Asia/Singapore";
    UTC = UTC;
    WAT = "Africa/Lagos";
    WEST = "Europe/Lisbon";
    WET = "Europe/Lisbon";
    WIT = "Asia/Jakarta";
}
查看更多
登录 后发表回答