Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.joda.time.DateTimeZone
org.joda.time.tz.FixedDateTimeZone
public final class FixedDateTimeZone
extends DateTimeZone
Field Summary |
Fields inherited from class org.joda.time.DateTimeZone | |
UTC |
Constructor Summary | |
|
Method Summary | |
boolean |
|
String |
|
int |
|
int |
|
int |
|
int |
|
boolean |
|
long |
|
long |
|
java.util.TimeZone |
|
Methods inherited from class org.joda.time.DateTimeZone | |
convertLocalToUTC , convertUTCToLocal , equals , forID , forOffsetHours , forOffsetHoursMinutes , forOffsetMillis , forTimeZone , getAvailableIDs , getDefault , getID , getMillisKeepLocal , getName , getName , getNameKey , getNameProvider , getOffset , getOffset , getOffsetFromLocal , getProvider , getShortName , getShortName , getStandardOffset , hashCode , isFixed , isLocalDateTimeGap , isStandardOffset , nextTransition , previousTransition , setDefault , setNameProvider , setProvider , toString , toTimeZone , writeReplace |
public FixedDateTimeZone(String id, String nameKey, int wallOffset, int standardOffset)
public boolean equals(Object obj)
Compare this datetime zone with another.
- Overrides:
- equals in interface DateTimeZone
- Parameters:
- Returns:
- true if equal, based on the ID and all internal rules
public String getNameKey(long instant)
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.
- Overrides:
- getNameKey in interface DateTimeZone
- Parameters:
instant
- milliseconds from 1970-01-01T00:00:00Z to get the name for
- Returns:
- name key or null if id should be used for names
public int getOffset(long instant)
Gets the millisecond offset to add to UTC to get local time.
- Overrides:
- getOffset in interface DateTimeZone
- Parameters:
instant
- milliseconds from 1970-01-01T00:00:00Z to get the offset for
- Returns:
- the millisecond offset to add to UTC to get local time
public int getOffsetFromLocal(long instantLocal)
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. This method will return an offset suitable for calculating an instant after any DST gap. For example, consider a zone with a cutover from 01:00 to 01:59:
Input: 00:00 Output: 00:00
Input: 00:30 Output: 00:30
Input: 01:00 Output: 02:00
Input: 01:30 Output: 02:30
Input: 02:00 Output: 02:00
Input: 02:30 Output: 02:30
NOTE: The behaviour of this method changed in v1.5, with the emphasis on returning a consistent result later along the time-line (shown above).
- Overrides:
- getOffsetFromLocal in interface DateTimeZone
- Parameters:
instantLocal
- the millisecond instant, relative to this time zone, to get the offset for
- Returns:
- the millisecond offset to subtract from local time to get UTC time
public int getStandardOffset(long instant)
Gets the standard millisecond offset to add to UTC to get local time, when standard time is in effect.
- Overrides:
- getStandardOffset in interface DateTimeZone
- Parameters:
instant
- milliseconds from 1970-01-01T00:00:00Z to get the offset for
- Returns:
- the millisecond offset to add to UTC to get local time
public int hashCode()
Gets a hash code compatable with equals.
- Overrides:
- hashCode in interface DateTimeZone
- Returns:
- suitable hashcode
public boolean isFixed()
Returns true if this time zone has no transitions.
- Overrides:
- isFixed in interface DateTimeZone
- Returns:
- true if no transitions
public long nextTransition(long instant)
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.
- Overrides:
- nextTransition in interface DateTimeZone
- Parameters:
instant
- milliseconds from 1970-01-01T00:00:00Z
- Returns:
- milliseconds from 1970-01-01T00:00:00Z
public long previousTransition(long instant)
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.
- Overrides:
- previousTransition in interface DateTimeZone
- Parameters:
instant
- milliseconds from 1970-01-01T00:00:00Z
- Returns:
- milliseconds from 1970-01-01T00:00:00Z
public java.util.TimeZone toTimeZone()
Override to return the correct timzone instance.
- Overrides:
- toTimeZone in interface DateTimeZone
- Since:
- 1.5