timezone.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 1,527 行 · 第 1/3 页
JAVA
1,527 行
/* java.util.TimeZone
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util;
import java.text.DateFormatSymbols;
/**
* This class represents a time zone offset and handles daylight savings.
*
* You can get the default time zone with <code>getDefault</code>.
* This represents the time zone where program is running.
*
* Another way to create a time zone is <code>getTimeZone</code>, where
* you can give an identifier as parameter. For instance, the identifier
* of the Central European Time zone is "CET".
*
* With the <code>getAvailableIDs</code> method, you can get all the
* supported time zone identifiers.
*
* @see Calendar
* @see SimpleTimeZone
* @author Jochen Hoenicke
*/
public abstract class TimeZone implements java.io.Serializable, Cloneable {
/**
* Constant used to indicate that a short timezone abbreviation should
* be returned, such as "EST"
*/
public static final int SHORT = 0;
/**
* Constant used to indicate that a long timezone name should be
* returned, such as "Eastern Standard Time".
*/
public static final int LONG = 1;
/**
* The time zone identifier, e.g. PST.
*/
private String ID;
/**
* The default time zone, as returned by getDefault.
*/
private static TimeZone defaultZone;
private static final long serialVersionUID = 3581463369166924961L;
/**
* Hashtable for timezones by ID.
*/
private static final Hashtable timezones = new Hashtable();
static {
TimeZone tz;
// Automatically generated by scripts/timezones.pl
// XXX - Should we read this data from a file?
tz = new SimpleTimeZone(-11000 * 3600, "MIT");
timezones.put("MIT", tz);
timezones.put("Pacific/Apia", tz);
timezones.put("Pacific/Midway", tz);
timezones.put("Pacific/Niue", tz);
timezones.put("Pacific/Pago_Pago", tz);
tz =
new SimpleTimeZone(
-10000 * 3600,
"America/Adak",
Calendar.APRIL,
1,
Calendar.SUNDAY,
2000 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
2000 * 3600);
timezones.put("America/Adak", tz);
tz = new SimpleTimeZone(-10000 * 3600, "HST");
timezones.put("HST", tz);
timezones.put("Pacific/Fakaofo", tz);
timezones.put("Pacific/Honolulu", tz);
timezones.put("Pacific/Johnston", tz);
timezones.put("Pacific/Rarotonga", tz);
timezones.put("Pacific/Tahiti", tz);
tz = new SimpleTimeZone(-9500 * 3600, "Pacific/Marquesas");
timezones.put("Pacific/Marquesas", tz);
tz =
new SimpleTimeZone(
-9000 * 3600,
"AST",
Calendar.APRIL,
1,
Calendar.SUNDAY,
2000 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
2000 * 3600);
timezones.put("AST", tz);
timezones.put("America/Anchorage", tz);
timezones.put("America/Juneau", tz);
timezones.put("America/Nome", tz);
timezones.put("America/Yakutat", tz);
tz = new SimpleTimeZone(-9000 * 3600, "Pacific/Gambier");
timezones.put("Pacific/Gambier", tz);
tz =
new SimpleTimeZone(
-8000 * 3600,
"PST",
Calendar.APRIL,
1,
Calendar.SUNDAY,
2000 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
2000 * 3600);
timezones.put("PST", tz);
timezones.put("PST8PDT", tz);
timezones.put("America/Dawson", tz);
timezones.put("America/Los_Angeles", tz);
timezones.put("America/Tijuana", tz);
timezones.put("America/Vancouver", tz);
timezones.put("America/Whitehorse", tz);
timezones.put("US/Pacific-New", tz);
tz = new SimpleTimeZone(-8000 * 3600, "Pacific/Pitcairn");
timezones.put("Pacific/Pitcairn", tz);
tz =
new SimpleTimeZone(
-7000 * 3600,
"MST",
Calendar.APRIL,
1,
Calendar.SUNDAY,
2000 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
2000 * 3600);
timezones.put("MST", tz);
timezones.put("MST7MDT", tz);
timezones.put("America/Boise", tz);
timezones.put("America/Chihuahua", tz);
timezones.put("America/Denver", tz);
timezones.put("America/Edmonton", tz);
timezones.put("America/Inuvik", tz);
timezones.put("America/Mazatlan", tz);
timezones.put("America/Shiprock", tz);
timezones.put("America/Yellowknife", tz);
tz = new SimpleTimeZone(-7000 * 3600, "MST7");
timezones.put("MST7", tz);
timezones.put("PNT", tz);
timezones.put("America/Dawson_Creek", tz);
timezones.put("America/Hermosillo", tz);
timezones.put("America/Phoenix", tz);
tz =
new SimpleTimeZone(
-6000 * 3600,
"CST",
Calendar.APRIL,
1,
Calendar.SUNDAY,
2000 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
2000 * 3600);
timezones.put("CST", tz);
timezones.put("CST6CDT", tz);
timezones.put("America/Cambridge_Bay", tz);
timezones.put("America/Cancun", tz);
timezones.put("America/Chicago", tz);
timezones.put("America/Menominee", tz);
timezones.put("America/Merida", tz);
timezones.put("America/Mexico_City", tz);
timezones.put("America/Monterrey", tz);
timezones.put("America/Rainy_River", tz);
timezones.put("America/Winnipeg", tz);
tz = new SimpleTimeZone(-6000 * 3600, "America/Belize");
timezones.put("America/Belize", tz);
timezones.put("America/Costa_Rica", tz);
timezones.put("America/El_Salvador", tz);
timezones.put("America/Guatemala", tz);
timezones.put("America/Managua", tz);
timezones.put("America/Regina", tz);
timezones.put("America/Swift_Current", tz);
timezones.put("America/Tegucigalpa", tz);
timezones.put("Pacific/Galapagos", tz);
tz =
new SimpleTimeZone(
-6000 * 3600,
"Pacific/Easter",
Calendar.OCTOBER,
9,
-Calendar.SUNDAY,
0 * 3600,
Calendar.MARCH,
9,
-Calendar.SUNDAY,
0 * 3600);
timezones.put("Pacific/Easter", tz);
tz =
new SimpleTimeZone(
-5000 * 3600,
"America/Grand_Turk",
Calendar.APRIL,
1,
Calendar.SUNDAY,
0 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
0 * 3600);
timezones.put("America/Grand_Turk", tz);
timezones.put("America/Havana", tz);
tz = new SimpleTimeZone(-5000 * 3600, "EST5");
timezones.put("EST5", tz);
timezones.put("IET", tz);
timezones.put("America/Bogota", tz);
timezones.put("America/Cayman", tz);
timezones.put("America/Eirunepe", tz);
timezones.put("America/Guayaquil", tz);
timezones.put("America/Indiana/Indianapolis", tz);
timezones.put("America/Indiana/Knox", tz);
timezones.put("America/Indiana/Marengo", tz);
timezones.put("America/Indiana/Vevay", tz);
timezones.put("America/Indianapolis", tz);
timezones.put("America/Iqaluit", tz);
timezones.put("America/Jamaica", tz);
timezones.put("America/Lima", tz);
timezones.put("America/Panama", tz);
timezones.put("America/Pangnirtung", tz);
timezones.put("America/Port-au-Prince", tz);
timezones.put("America/Porto_Acre", tz);
timezones.put("America/Rankin_Inlet", tz);
tz =
new SimpleTimeZone(
-5000 * 3600,
"EST",
Calendar.APRIL,
1,
Calendar.SUNDAY,
2000 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
2000 * 3600);
timezones.put("EST", tz);
timezones.put("EST5EDT", tz);
timezones.put("America/Detroit", tz);
timezones.put("America/Kentucky/Louisville", tz);
timezones.put("America/Kentucky/Monticello", tz);
timezones.put("America/Louisville", tz);
timezones.put("America/Montreal", tz);
timezones.put("America/Nassau", tz);
timezones.put("America/New_York", tz);
timezones.put("America/Nipigon", tz);
timezones.put("America/Thunder_Bay", tz);
tz = new SimpleTimeZone(-4000 * 3600, "PRT");
timezones.put("PRT", tz);
timezones.put("America/Anguilla", tz);
timezones.put("America/Antigua", tz);
timezones.put("America/Aruba", tz);
timezones.put("America/Barbados", tz);
timezones.put("America/Boa_Vista", tz);
timezones.put("America/Caracas", tz);
timezones.put("America/Curacao", tz);
timezones.put("America/Dominica", tz);
timezones.put("America/Grenada", tz);
timezones.put("America/Guadeloupe", tz);
timezones.put("America/Guyana", tz);
timezones.put("America/La_Paz", tz);
timezones.put("America/Manaus", tz);
timezones.put("America/Martinique", tz);
timezones.put("America/Montserrat", tz);
timezones.put("America/Port_of_Spain", tz);
timezones.put("America/Porto_Velho", tz);
timezones.put("America/Puerto_Rico", tz);
timezones.put("America/Santo_Domingo", tz);
timezones.put("America/St_Kitts", tz);
timezones.put("America/St_Lucia", tz);
timezones.put("America/St_Thomas", tz);
timezones.put("America/St_Vincent", tz);
timezones.put("America/Tortola", tz);
tz =
new SimpleTimeZone(
-4000 * 3600,
"America/Asuncion",
Calendar.OCTOBER,
1,
Calendar.SUNDAY,
0 * 3600,
Calendar.FEBRUARY,
-1,
Calendar.SUNDAY,
0 * 3600);
timezones.put("America/Asuncion", tz);
tz =
new SimpleTimeZone(
-4000 * 3600,
"America/Cuiaba",
Calendar.OCTOBER,
2,
Calendar.SUNDAY,
0 * 3600,
Calendar.FEBRUARY,
3,
Calendar.SUNDAY,
0 * 3600);
timezones.put("America/Cuiaba", tz);
tz =
new SimpleTimeZone(
-4000 * 3600,
"America/Goose_Bay",
Calendar.APRIL,
1,
Calendar.SUNDAY,
60000,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
60000);
timezones.put("America/Goose_Bay", tz);
tz =
new SimpleTimeZone(
-4000 * 3600,
"America/Glace_Bay",
Calendar.APRIL,
1,
Calendar.SUNDAY,
2000 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
2000 * 3600);
timezones.put("America/Glace_Bay", tz);
timezones.put("America/Halifax", tz);
timezones.put("America/Thule", tz);
timezones.put("Atlantic/Bermuda", tz);
tz =
new SimpleTimeZone(
-4000 * 3600,
"America/Santiago",
Calendar.OCTOBER,
9,
-Calendar.SUNDAY,
0 * 3600,
Calendar.MARCH,
9,
-Calendar.SUNDAY,
0 * 3600);
timezones.put("America/Santiago", tz);
timezones.put("Antarctica/Palmer", tz);
tz =
new SimpleTimeZone(
-4000 * 3600,
"Atlantic/Stanley",
Calendar.SEPTEMBER,
2,
Calendar.SUNDAY,
0 * 3600,
Calendar.APRIL,
16,
-Calendar.SUNDAY,
0 * 3600);
timezones.put("Atlantic/Stanley", tz);
tz =
new SimpleTimeZone(
-3500 * 3600,
"CNT",
Calendar.APRIL,
1,
Calendar.SUNDAY,
60000,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
60000);
timezones.put("CNT", tz);
timezones.put("America/St_Johns", tz);
tz =
new SimpleTimeZone(
-3000 * 3600,
"America/Araguaina",
Calendar.OCTOBER,
2,
Calendar.SUNDAY,
0 * 3600,
Calendar.FEBRUARY,
3,
Calendar.SUNDAY,
0 * 3600);
timezones.put("America/Araguaina", tz);
timezones.put("America/Sao_Paulo", tz);
tz = new SimpleTimeZone(-3000 * 3600, "AGT");
timezones.put("AGT", tz);
timezones.put("America/Belem", tz);
timezones.put("America/Buenos_Aires", tz);
timezones.put("America/Catamarca", tz);
timezones.put("America/Cayenne", tz);
timezones.put("America/Cordoba", tz);
timezones.put("America/Fortaleza", tz);
timezones.put("America/Jujuy", tz);
timezones.put("America/Maceio", tz);
timezones.put("America/Mendoza", tz);
timezones.put("America/Montevideo", tz);
timezones.put("America/Paramaribo", tz);
timezones.put("America/Recife", tz);
timezones.put("America/Rosario", tz);
tz =
new SimpleTimeZone(
-3000 * 3600,
"America/Godthab",
Calendar.MARCH,
30,
-Calendar.SATURDAY,
22000 * 3600,
Calendar.OCTOBER,
30,
-Calendar.SATURDAY,
22000 * 3600);
timezones.put("America/Godthab", tz);
tz =
new SimpleTimeZone(
-3000 * 3600,
"America/Miquelon",
Calendar.APRIL,
1,
Calendar.SUNDAY,
2000 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
2000 * 3600);
timezones.put("America/Miquelon", tz);
tz = new SimpleTimeZone(-2000 * 3600, "America/Noronha");
timezones.put("America/Noronha", tz);
timezones.put("Atlantic/South_Georgia", tz);
tz =
new SimpleTimeZone(
-1000 * 3600,
"America/Scoresbysund",
Calendar.MARCH,
-1,
Calendar.SUNDAY,
0 * 3600,
Calendar.OCTOBER,
-1,
Calendar.SUNDAY,
0 * 3600);
timezones.put("America/Scoresbysund", tz);
timezones.put("Atlantic/Azores", tz);
tz = new SimpleTimeZone(-1000 * 3600, "Atlantic/Cape_Verde");
timezones.put("Atlantic/Cape_Verde", tz);
timezones.put("Atlantic/Jan_Mayen", tz);
tz = new SimpleTimeZone(0 * 3600, "GMT");
timezones.put("GMT", tz);
timezones.put("UTC", tz);
timezones.put("Africa/Abidjan", tz);
timezones.put("Africa/Accra", tz);
timezones.put("Africa/Bamako", tz);
timezones.put("Africa/Banjul", tz);
timezones.put("Africa/Bissau", tz);
timezones.put("Africa/Casablanca", tz);
timezones.put("Africa/Conakry", tz);
timezones.put("Africa/Dakar", tz);
timezones.put("Africa/El_Aaiun", tz);
timezones.put("Africa/Freetown", tz);
timezones.put("Africa/Lome", tz);
timezones.put("Africa/Monrovia", tz);
timezones.put("Africa/Nouakchott", tz);
timezones.put("Africa/Ouagadougou", tz);
timezones.put("Africa/Sao_Tome", tz);
timezones.put("Africa/Timbuktu", tz);
timezones.put("Atlantic/Reykjavik", tz);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?