Introduction
The java.util.TimeZone class represents a time zone offset, and also figures out daylight savings.Following are the important points about TimeZone:- It takes into consideration various time zone.
- Through the method used under this class a program running in any country, gets a TimeZone object based on that particular country's time zone.
Class declaration
Following is the declaration for java.util.TimeZone class:public abstract class TimeZone extends Object implements Serializable, Cloneable
Field
Following are the fields for java.util.TimeZone class:- static int LONG -- This is the style specifier for getDisplayName() indicating a long name, such as "Pacific Standard Time."
- static int SHORT -- This is the style specifier for getDisplayName() indicating a short name, such as "Pacific.Standard Time".
Class constructors
S.N. | Constructor & Description |
---|---|
1 | TimeZone() This constructor is the single constructor for invocation by subclass constructors. |
Class methods
S.N. | Method & Description |
---|---|
1 | Object clone() This method creates a copy of this TimeZon |
2 | static String[] getAvailableIDs() This method gets all the available IDs supported. |
3 | static String[] getAvailableIDs(int rawOffset) This method gets the available IDs according to the given time zone offset in milliseconds. |
4 | static TimeZone getDefault() This method gets the default TimeZone for this host. |
5 | String getDisplayName() This method returns a name of this time zone suitable for presentation to the user in the default locale. |
6 | String getDisplayName(boolean daylight, int style) This method returns a name of this time zone suitable for presentation to the user in the default locale. |
7 | String getDisplayName(boolean daylight, int style, Locale locale) This method returns a name of this time zone suitable for presentation to the user in the specified locale. |
8 | String getDisplayName(Locale locale) This method returns a name of this time zone suitable for presentation to the user in the specified locale. |
9 | int getDSTSavings() This method returns the amount of time to be added to local standard time to get local wall clock time. |
10 | String getID() This method gets the ID of this time zone |
11 | abstract int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds) This method gets the time zone offset, for current date, modified in case of daylight savings. |
12 | int getOffset(long date) This method returns the offset of this time zone from UTC at the specified date. |
13 | abstract int getRawOffset() This method returns the amount of time in milliseconds to add to UTC to get standard time in this time zone. |
14 | static TimeZone getTimeZone(String ID) This method gets the TimeZone for the given ID. |
15 | boolean hasSameRules(TimeZone other) This method returns true if this zone has the same rule and offset as another zone. |
16 | abstract boolean inDaylightTime(Date date) This method queries if the given date is in daylight savings time in this time zone. |
17 | static void setDefault(TimeZone zone) This method sets the TimeZone that is returned by the getDefault method. |
18 | void setID(String ID) This method sets the time zone ID |
19 | abstract void setRawOffset(int offsetMillis) This method sets the base time zone offset to GMT. |
20 | abstract boolean useDaylightTime() This method queries if this time zone uses daylight savings time. |
Methods inherited
This class inherits methods from the following classes:- java.util.Object
No comments:
Post a Comment