Java TimeZone Create getAvailableTimezones()

Here you can find the source of getAvailableTimezones()

Description

get Available Timezones

License

Open Source License

Declaration

public static Collection<TimeZone> getAvailableTimezones() 

Method Source Code

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

import java.util.Collection;
import java.util.Comparator;
import java.util.TimeZone;
import java.util.TreeSet;

public class Main {
    public static Collection<TimeZone> getAvailableTimezones() {
        final Collection<TimeZone> tZones = new TreeSet<TimeZone>(
                new Comparator<TimeZone>() {
                    @Override//from   ww  w  .ja  v a 2  s.  co m
                    public int compare(TimeZone o1, TimeZone o2) {
                        return o1.getID().compareTo(o2.getID());
                    }
                });
        for (String id : TimeZone.getAvailableIDs()) {
            tZones.add(TimeZone.getTimeZone(id));
        }
        return tZones;
    }
}

Related

  1. codeToTimeZone(String tzString)
  2. getCurrentTimezone()
  3. getCurrentTimeZoneTime()
  4. getServerTimeZone()
  5. getTimeZone()