Joda Time API

org.joda.time.tz
Class FixedDateTimeZone

java.lang.Object
  |
  +--org.joda.time.DateTimeZone
        |
        +--org.joda.time.tz.FixedDateTimeZone
All Implemented Interfaces:
java.io.Serializable

public final class FixedDateTimeZone
extends DateTimeZone

Basic DateTimeZone implementation that has a fixed name key and offsets.

Author:
Brian S O'Neill
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.joda.time.DateTimeZone
UTC
 
Constructor Summary
FixedDateTimeZone(java.lang.String id, java.lang.String nameKey, int wallOffset, int standardOffset)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare this datetime zone with another.
 java.lang.String getNameKey(long millis)
          Returns a non-localized name that is unique to this time zone.
 int getOffset(long millis)
          Gets the millisecond offset to add to UTC to get local time.
 int getOffsetFromLocal(long millisLocal)
          Gets the millisecond offset to subtract from local time to get UTC time.
 int getStandardOffset(long millis)
          Gets the standard millisecond offset to add to UTC to get local time, when standard time is in effect.
 long nextTransition(long millis)
          Advances the given instant to where the time zone offset or name changes.
 long previousTransition(long millis)
          Retreats the given instant to where the time zone offset or name changes.
 
Methods inherited from class org.joda.time.DateTimeZone
getAvailableIDs, getDefault, getID, getInstance, getInstance, getName, getName, getNameProvider, getOffset, getProvider, getShortName, getShortName, hashCode, setDefault, setNameProvider, setProvider, toString, toTimeZone, writeReplace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FixedDateTimeZone

public FixedDateTimeZone(java.lang.String id,
                         java.lang.String nameKey,
                         int wallOffset,
                         int standardOffset)
Method Detail

getNameKey

public java.lang.String getNameKey(long millis)
Description copied from class: DateTimeZone
Returns a non-localized name that is unique to this time zone. It can be combined with id to form a unique key for fetching localized names.

Specified by:
getNameKey in class DateTimeZone
Parameters:
millis - milliseconds from 1970-01-01T00:00:00Z to get the name for
Returns:
name key or null if id should be used for names

getOffset

public int getOffset(long millis)
Description copied from class: DateTimeZone
Gets the millisecond offset to add to UTC to get local time.

Specified by:
getOffset in class DateTimeZone
Parameters:
millis - milliseconds from 1970-01-01T00:00:00Z to get the offset for
Returns:
the millisecond offset to add to UTC to get local time

getStandardOffset

public int getStandardOffset(long millis)
Description copied from class: DateTimeZone
Gets the standard millisecond offset to add to UTC to get local time, when standard time is in effect.

Specified by:
getStandardOffset in class DateTimeZone
Parameters:
millis - milliseconds from 1970-01-01T00:00:00Z to get the offset for
Returns:
the millisecond offset to add to UTC to get local time

getOffsetFromLocal

public int getOffsetFromLocal(long millisLocal)
Description copied from class: DateTimeZone
Gets the millisecond offset to subtract from local time to get UTC time. This offset can be used to undo adding the offset obtained by getOffset.
 millisLocal == millisUTC   + getOffset(millisUTC)
 millisUTC   == millisLocal - getOffsetFromLocal(millisLocal)
 
Note: After calculating millisLocal, some error may be introduced. At offset transitions (due to DST or other historical changes), ranges of local times may map to different UTC times.

Overrides:
getOffsetFromLocal in class DateTimeZone
Parameters:
millisLocal - the millisecond instant, relative to this time zone, to get the offset for
Returns:
the millisceond offset to subtract from local time to get UTC time.

nextTransition

public long nextTransition(long millis)
Description copied from class: DateTimeZone
Advances the given instant to where the time zone offset or name changes. If the instant returned is exactly the same as passed in, then no changes occur after the given instant.

Specified by:
nextTransition in class DateTimeZone
Parameters:
millis - milliseconds from 1970-01-01T00:00:00Z
Returns:
milliseconds from 1970-01-01T00:00:00Z

previousTransition

public long previousTransition(long millis)
Description copied from class: DateTimeZone
Retreats the given instant to where the time zone offset or name changes. If the instant returned is exactly the same as passed in, then no changes occur before the given instant.

Specified by:
previousTransition in class DateTimeZone
Parameters:
millis - milliseconds from 1970-01-01T00:00:00Z
Returns:
milliseconds from 1970-01-01T00:00:00Z

equals

public boolean equals(java.lang.Object obj)
Description copied from class: DateTimeZone
Compare this datetime zone with another.

Specified by:
equals in class DateTimeZone
Returns:
true if equal, based on the ID and all internal rules

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.