Where can I get a list of abbreviations for timeZoneWithAbbreviation?

前端 未结 3 1072
深忆病人
深忆病人 2021-02-02 08:29

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

NSTimeZone *some_time_zone = [NSTimeZone timeZoneWithAbbreviation:name];

ho

相关标签:
3条回答
  • 2021-02-02 08:31

    Swift 3.0:

    print("\(NSTimeZone.abbreviationDictionary)")
    
    0 讨论(0)
  • 2021-02-02 08:40

    Try [NSTimeZone abbreviationDictionary] or [NSTimeZone knownTimeZoneNames].

    0 讨论(0)
  • 2021-02-02 08:56

    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";
    }
    
    0 讨论(0)
提交回复
热议问题