Java TimeZone Get getAvailableTimezones()

Here you can find the source of getAvailableTimezones()

Description

get Available Timezones

License

Open Source License

Declaration

public synchronized static String[] getAvailableTimezones() 

Method Source Code

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

import java.text.DecimalFormat;

import java.util.ArrayList;

import java.util.TimeZone;

public class Main {
    private static String[] timezones = null;

    public synchronized static String[] getAvailableTimezones() {
        if (null == timezones) {
            DecimalFormat df = new DecimalFormat("'GMT'+00':00';'GMT'-00':00'");
            ArrayList<String> tzs = new ArrayList<String>(29);
            tzs.add("UTC");
            tzs.add("GMT");
            tzs.add(TimeZone.getDefault().getID());
            for (int i = -12; i < 15; i++) {
                tzs.add(df.format(i));/*  ww w  . j  a  va  2 s  . co  m*/
            }
            timezones = tzs.toArray(new String[tzs.size()]);
        }
        return timezones;
    }
}

Related

  1. getAdjustedDateTime(Date dt, TimeZone tz)
  2. getAllTimezonesSorted()
  3. getAsTimeZone(Map params, String propName)
  4. getCal(int dayOfMonth, int month, int year, int hours, int minutes, int seconds, String timezone)
  5. getCalendarForTimeZone(final String timeZone)
  6. getCalendarInstance(TimeZone timeZone, Locale locale)
  7. getConvertDateString(Date date, TimeZone tz, String fmt)