com.plumtree.openfoundation.internationalization
Class XPTimeZone

java.lang.Object
  extended by com.plumtree.openfoundation.internationalization.XPTimeZone

public class XPTimeZone
extends java.lang.Object

XPTimeZone represents a time zone offset, and also figures out daylight savings.


Constructor Summary
XPTimeZone()
          Default Constructor that initializes to the default timezone.
XPTimeZone(java.util.TimeZone timeZone)
          Create a new XPTimeZone instance wrapping the local platform equivalent.
 
Method Summary
static java.lang.String[] GetAvailableTimeZoneNames()
          Gets all the available TimeZone IDs (e.g.
static java.lang.String[] GetAvailableTimeZoneNames(long offset)
          Gets all the available TimeZone IDs according to the given time zone offset (e.g.
static XPTimeZone GetCurrentTimeZone()
          Gets the default TimeZone for this host.
 java.lang.String GetDaylightName()
          Returns a short daylight name of the timezone in the default locale.
 java.lang.String GetStandardName()
          Returns a short standard name of the timezone in the default locale.
static XPTimeZone GetTimeZone(java.lang.String ID)
          Gets the TimeZone for the given ID.
 java.lang.String GetTZName()
          Returns the ID (e.g.
 java.util.TimeZone GetUnderlyingObject()
          Returns the platform specific object that this class wraps.
 long GetUtcOffset(XPDateTime dateTime)
          Gets the time zone offset, for current date, modified in case of daylight savings time.
 boolean IsDaylightSavingTime(XPDateTime dateTime)
          Queries if the given date is in daylight savings time in this time zone.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPTimeZone

public XPTimeZone()
Default Constructor that initializes to the default timezone.


XPTimeZone

public XPTimeZone(java.util.TimeZone timeZone)
Create a new XPTimeZone instance wrapping the local platform equivalent.

Parameters:
timeZone - underlying TimeZone object.
Method Detail

GetStandardName

public java.lang.String GetStandardName()
Returns a short standard name of the timezone in the default locale.

Returns:
the human-readable standard name of this time zone in the default locale

GetDaylightName

public java.lang.String GetDaylightName()
Returns a short daylight name of the timezone in the default locale.

Returns:
the human-readable daylight name of this time zone in the default locale

GetTZName

public java.lang.String GetTZName()
Returns the ID (e.g. America/Los_Angeles) of this TimeZone, which is a string name in TZ database.

Returns:
a String ID corresponding to current timezone.

GetCurrentTimeZone

public static XPTimeZone GetCurrentTimeZone()
Gets the default TimeZone for this host.

Returns:
a default TimeZone

GetTimeZone

public static XPTimeZone GetTimeZone(java.lang.String ID)
Gets the TimeZone for the given ID.

Parameters:
ID - the ID for a TimeZone (e.g. America/Los_Angeles)
Returns:
the specified TimeZone, or the GMT zone if the given ID cannot be understood

GetAvailableTimeZoneNames

public static java.lang.String[] GetAvailableTimeZoneNames()
Gets all the available TimeZone IDs (e.g. America/Los_Angeles)

Returns:
an array of TimeZone IDs

GetAvailableTimeZoneNames

public static java.lang.String[] GetAvailableTimeZoneNames(long offset)
Gets all the available TimeZone IDs according to the given time zone offset (e.g. -28800000 i.e. (GMT-08:00))

Parameters:
offset - a value representing offset from GMT.
Returns:
an array of TimeZone IDs

IsDaylightSavingTime

public boolean IsDaylightSavingTime(XPDateTime dateTime)
Queries if the given date is in daylight savings time in this time zone.

Parameters:
dateTime - - the given Date
Returns:
true if the given Date is in daylight savins time, otherwise false. The return value could be inaccurate i.e. either true or false if the given date is in the boundary values i.e. in that 1 hr boundary during which the daylight saving is enabled/disabled.

GetUtcOffset

public long GetUtcOffset(XPDateTime dateTime)
Gets the time zone offset, for current date, modified in case of daylight savings time. local time = UTC + offset (obtained using this method)

Parameters:
dateTime - - the given Date
Returns:
the offset to add to UTC to get local time

GetUnderlyingObject

public java.util.TimeZone GetUnderlyingObject()
Returns the platform specific object that this class wraps.

Returns:
- An instance of Timezone class


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.