public class TimeZone extends java.lang.Object implements TimeZone
TimeZoneConstants
class. Applications can also choose to instantiate from a string obtained
from a server. The time zone string contains locale specific data. If the
application only uses a short representation, the English data will usually
satisfy the user's need. In the case that only the time zone offset is known,
there is a decent fallback that only uses the time zone offset to create a
TimeZone object.Modifier and Type | Method and Description |
---|---|
static TimeZone |
createTimeZone(int timeZoneOffsetInMinutes)
This factory method provides a decent fallback to create a time zone object
just based on a given time zone offset.
|
static TimeZone |
createTimeZone(java.lang.String tzJSON)
This factory method creates a time zone instance from a JSON string that
contains the time zone information for desired time zone.
|
static TimeZone |
createTimeZone(TimeZoneInfo timezoneData) |
int |
getDaylightAdjustment(java.util.Date date)
Returns the daylight savings time adjustment, in minutes, for the given
date.
|
java.lang.String |
getGMTString(java.util.Date date)
Returns the GMT representation of this time zone object.
|
java.lang.String |
getID()
Returns time zone id for this time zone.
|
java.lang.String |
getISOTimeZoneString(java.util.Date date)
To get ISO-style (+00:00) representation of the time zone for given date.
|
java.lang.String |
getLongName(java.util.Date date)
Returns the long version of the time zone name for the given date; the
result of this method will be different if daylight savings time is in
effect.
|
int |
getOffset(java.util.Date date)
Returns the RFC representation of the time zone name for the given date.
|
java.lang.String |
getRFCTimeZoneString(java.util.Date date)
To get RFC representation of certain time zone name for given date.
|
java.lang.String |
getShortName(java.util.Date date)
Returns the short time zone name for a given date.
|
int |
getStandardOffset()
Returns the standard time zone offset, in minutes.
|
boolean |
isDaylightTime(java.util.Date date)
Check whether the given date and time falls within a daylight savings time
period.
|
public static TimeZone createTimeZone(int timeZoneOffsetInMinutes)
timeZoneOffsetInMinutes
- time zone offset in minutespublic static TimeZone createTimeZone(java.lang.String tzJSON)
tzJSON
- JSON string that contains time zone datapublic static TimeZone createTimeZone(TimeZoneInfo timezoneData)
public int getDaylightAdjustment(java.util.Date date)
TimeZone
getDaylightAdjustment
in interface TimeZone
date
- the date to checkpublic java.lang.String getGMTString(java.util.Date date)
TimeZone
getGMTString
in interface TimeZone
date
- The date from which the time information should be extractedpublic java.lang.String getID()
TimeZone
public java.lang.String getISOTimeZoneString(java.util.Date date)
TimeZone
getISOTimeZoneString
in interface TimeZone
date
- The date for which time to retrieve RFC time zone stringpublic java.lang.String getLongName(java.util.Date date)
TimeZone
getLongName
in interface TimeZone
date
- The date for which the long time zone name is returnedpublic int getOffset(java.util.Date date)
TimeZone
public java.lang.String getRFCTimeZoneString(java.util.Date date)
TimeZone
getRFCTimeZoneString
in interface TimeZone
date
- The date for which time to retrieve RFC time zone stringpublic java.lang.String getShortName(java.util.Date date)
TimeZone
getShortName
in interface TimeZone
date
- The date for which time to retrieve short time zonepublic int getStandardOffset()
TimeZone
getStandardOffset
in interface TimeZone
public boolean isDaylightTime(java.util.Date date)
TimeZone
isDaylightTime
in interface TimeZone
date
- and time to check