Java TimeZone Create getTimezoneList()

Here you can find the source of getTimezoneList()

Description

get Timezone List

License

Open Source License

Declaration

public static String[] getTimezoneList() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.TimeZone;

public class Main {
    public static String[] getTimezoneList() {
        return TimeZone.getAvailableIDs();
    }/*from   w  ww .  ja  v  a2 s . c o  m*/

    /**
     * Get the timezone list for a specific offset from UTC(in hours)
     * @param hoursOffset
     * @return
     */
    public static String[] getTimezoneList(int hoursOffset) {
        ArrayList list = new ArrayList();
        list.add("");
        String[] s1 = TimeZone.getAvailableIDs(hoursOffset * 3600000);
        for (int i = 0; i != s1.length; i++) {
            list.add(s1[i]);
        }
        return (String[]) list.toArray(new String[0]);
    }
}

Related

  1. getTimezoneAbbreviation(String tzid, boolean dst)
  2. getTimeZoneChecked(String id)
  3. getTimeZoneCorrectedProgramId(String progID)
  4. getTimeZoneDefault()
  5. getTimeZoneIds()
  6. getTimeZoneList()
  7. getTimeZoneMap()
  8. getTimeZoneOfTenant()
  9. getTotalTimeZoneOffset(TimeZone zone)