⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e371. retrieving information on all available time zones.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
This example lists all time zones known by the JDK. 
    Date today = new Date();
    
    // Get all time zone ids
    String[] zoneIds = TimeZone.getAvailableIDs();
    
    // View every time zone
    for (int i=0; i<zoneIds.length; i++) {
        // Get time zone by time zone id
        TimeZone tz = TimeZone.getTimeZone(zoneIds[i]);
    
        // Get the display name
        String shortName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.SHORT);
        String longName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.LONG);
    
        // Get the number of hours from GMT
        int rawOffset = tz.getRawOffset();
        int hour = rawOffset / (60*60*1000);
        int min = Math.abs(rawOffset / (60*1000)) % 60;
    
        // Does the time zone have a daylight savings time period?
        boolean hasDST = tz.useDaylightTime();
    
        // Is the time zone currently in a daylight savings time?
        boolean inDST = tz.inDaylightTime(today);
    }

Here's a few time zone entries: 
    Id, Short Name, Long Name, Hour:Time from GMT
    
    ACT, CST, Central Standard Time (Northern Territory) 9:30
    AET, EST, Eastern Summer Time (New South Wales) 10:0
    AGT, ART, Argentine Time -3:0
    ART, EET, Eastern European Time 2:0
    AST, AKST, Alaska Standard Time -9:0
    Africa/Abidjan, GMT, Greenwich Mean Time 0:0
    Africa/Accra, GMT, Greenwich Mean Time 0:0
    Africa/Addis_Ababa, EAT, Eastern African Time 3:0
    Africa/Algiers, CET, Central European Time 1:0
    Africa/Asmera, EAT, Eastern African Time 3:0
    Africa/Bamako, GMT, Greenwich Mean Time 0:0
    Africa/Bangui, WAT, Western African Time 1:0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -