Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.i18n.client
Class TimeZone

    java.lang.Object
      com.google.gwt.i18n.client.TimeZone

All Implemented Interfaces:
  TimeZone

    public class TimeZone

extends java.lang.Object
implements TimeZone

The TimeZone class implements a time zone information source for client applications. The time zone object is instantiated from a TimeZoneData object, which is made from a JSON string that contains all the data needed for the specified time zone. Applications can instantiate a time zone statically, in which case the data could be retrieved from the `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.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### createTimeZone

    public 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.

  Parameters:
    `timeZoneOffsetInMinutes` - time zone offset in minutes
  Returns:
    a new time zone object

### createTimeZone

    public 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. Applications can get such a string from the TimeZoneConstants class, or it can request the string from the server. Either way, the application obtains the original string from the data provided in the TimeZoneConstant.properties file, which was carefully prepared from CLDR and Olson time zone database.

  Parameters:
    `tzJSON` - JSON string that contains time zone data
  Returns:
    a new time zone object

### createTimeZone

    public static TimeZone createTimeZone(TimeZoneInfo timezoneData)

### getDaylightAdjustment

    public int getDaylightAdjustment(java.util.Date date)

  Description copied from interface: `TimeZone`
  Returns the daylight savings time adjustment, in minutes, for the given date. If daylight savings time is in effect on the given date, the number will be positive, otherwise 0.

  Specified by:
    `getDaylightAdjustment` in interface `TimeZone`
  Parameters:
    `date` - the date to check
  Returns:
    offset amount

### getGMTString

    public java.lang.String getGMTString(java.util.Date date)

  Description copied from interface: `TimeZone`
  Returns the GMT representation of this time zone object.

  Specified by:
    `getGMTString` in interface `TimeZone`
  Parameters:
    `date` - The date from which the time information should be extracted
  Returns:
    A GMT representation of the time given by the date

### getID

    public java.lang.String getID()

  Description copied from interface: `TimeZone`
  Returns time zone id for this time zone. For time zone objects that have been instantiated from a time zone offset, the POSIX time zone id will be returned.

  Specified by:
    `getID` in interface `TimeZone`
  Returns:
    time zone id

### getISOTimeZoneString

    public java.lang.String getISOTimeZoneString(java.util.Date date)

  Description copied from interface: `TimeZone`
  To get ISO-style (+00:00) representation of the time zone for given date.

  Specified by:
    `getISOTimeZoneString` in interface `TimeZone`
  Parameters:
    `date` - The date for which time to retrieve RFC time zone string
  Returns:
    ISO-style time zone string

### getLongName

    public java.lang.String getLongName(java.util.Date date)

  Description copied from interface: `TimeZone`
  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.

  Specified by:
    `getLongName` in interface `TimeZone`
  Parameters:
    `date` - The date for which the long time zone name is returned
  Returns:
    long time zone name

### getOffset

    public int getOffset(java.util.Date date)

  Description copied from interface: `TimeZone`
  Returns the RFC representation of the time zone name for the given date. To be consistent with JDK/Javascript API, west of Greenwich will be positive.

  Specified by:
    `getOffset` in interface `TimeZone`
  Parameters:
    `date` - The date for which time to retrieve time zone offset
  Returns:
    time zone offset in minutes

### getRFCTimeZoneString

    public java.lang.String getRFCTimeZoneString(java.util.Date date)

  Description copied from interface: `TimeZone`
  To get RFC representation of certain time zone name for given date.

  Specified by:
    `getRFCTimeZoneString` in interface `TimeZone`
  Parameters:
    `date` - The date for which time to retrieve RFC time zone string
  Returns:
    RFC time zone string

### getShortName

    public java.lang.String getShortName(java.util.Date date)

  Description copied from interface: `TimeZone`
  Returns the short time zone name for a given date.

  Specified by:
    `getShortName` in interface `TimeZone`
  Parameters:
    `date` - The date for which time to retrieve short time zone
  Returns:
    short time zone name

### getStandardOffset

    public int getStandardOffset()

  Description copied from interface: `TimeZone`
  Returns the standard time zone offset, in minutes.

  Specified by:
    `getStandardOffset` in interface `TimeZone`

### isDaylightTime

    public boolean isDaylightTime(java.util.Date date)

  Description copied from interface: `TimeZone`
  Check whether the given date and time falls within a daylight savings time period.

  Specified by:
    `isDaylightTime` in interface `TimeZone`
  Parameters:
    `date` - and time to check
  Returns:
    true if daylight savings time is in effect

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD