Java TimeZone Create getTimeZone(final String tzId)

Here you can find the source of getTimeZone(final String tzId)

Description

Gets the time zone.

License

Open Source License

Parameter

Parameter Description
tzId the tz id

Return

the time zone

Declaration

public static TimeZone getTimeZone(final String tzId) 

Method Source Code

//package com.java2s;

import java.util.TimeZone;

public class Main {
    /**/*from  w w  w. j a  v  a 2s . c o m*/
     * Gets the time zone.
     * 
     * @param tzId
     *            the tz id
     * @return the time zone
     */
    public static TimeZone getTimeZone(final String tzId) {
        if (tzId == null) {
            throw new IllegalArgumentException("getTimeZone");
        }
        TimeZone tz = TimeZone.getTimeZone(tzId);
        if (!tz.getID().equals(tzId)) {
            throw new IllegalArgumentException("getTimeZone");
        }
        return tz;
    }
}

Related

  1. getTimeZone()
  2. getTimeZone()
  3. getTimeZone(Date date)
  4. getTimeZone(final Calendar cal)
  5. getTimeZone(final String id)
  6. getTimeZone(int rawoffset)
  7. getTimeZone(String id)
  8. getTimeZone(String idParam)
  9. getTimeZone(String timeZone)