PATH |
- Inherits from:
- java.util.TimeZone : Object
- Implements:
- Cloneable
- Serializable
- NSCoding
- Package:
- com.webobjects.foundation
NSTimeZone defines the behavior of time zone objects. Time zone objects represent geopolitical regions. Consequently, these objects have names for these regions. Time zone objects also represent a temporal offset, either plus or minus, from Greenwich Mean Time (GMT) and an abbreviation (such as "PST").
NSTimeZone provides several constructors to get time zone objects. The class also permits you to set the default time zone within your application ( setDefaultTimeZone). You can access this default time zone at any time with the defaultTimeZone static method, and with the localTimeZone static method, you can get a relative time zone object that decodes itself to become the default time zone for any locale in which it finds itself.
Because NSTimeZone is a subclass of java.util.TimeZone, you can also use the java.util.TimeZone API with NSTimeZones.
WARNING NSTimeZone is only intended to be used with NSTimestamp and NSTimestampFormatter. It produces incorrect results when used with Java's date-related classes.Some NSTimestamp methods return date objects that are automatically bound to time zone objects. These date objects use the functionality of NSTimeZone to adjust dates for the proper locale. Unless you specify otherwise, objects returned from NSTimestamp are bound to the default time zone for the current locale.
- Cloneable
- clone
- java.io.Serializable
- NSCoding
- decodeObject
- classForCoder
- encodeWithCoder
- Constructors
- NSTimeZone
- Getting the default time zone
- localTimeZone
- defaultTimeZone
- setDefaultTimeZone
- resetSystemTimeZone
- Getting time zone information
- abbreviationDictionary
- knownTimeZoneNames
- Getting information about a specific time zone
- abbreviation
- abbreviationForTimestamp
- name
- secondsFromGMT
- secondsFromGMTForTimestamp
- isDaylightSavingTime
- isDaylightSavingTimeForTimestamp
- data
- Comparing time zones
- equals
- isEqualToTimeZone
- Instance methods inherited from java.util.TimeZone
- getAvailableIDs
- getDefault
- getDisplayName
- getID
- getOffset
- getRawOffset
- hasSameRules
- inDaylightTime
- setDefault
- setID
- setRawOffset
- useDaylightTime
public NSTimeZone()
protected NSTimeZone( String aTimeZoneName, NSData data)
This constructor is used internally by NSTimeZone and should be considered private. Use the static factory methods to create time zones.
public static NSDictionary abbreviationDictionary()
More than one time zone may have the same abbreviation. For example, US/Pacific and Canada/Pacific both use the abbreviation "PST." In these cases abbreviationDictionary chooses a single name to map the abbreviation to.
public static Object decodeObject(NSCoder coder)
See Also: NSCoding Interface Description
public static synchronized NSTimeZone defaultTimeZone()
See Also: localTimeZone, setDefaultTimeZone, systemTimeZone
public static String[] getAvailableIDs()
public static java.util.TimeZone getDefault()
public static NSArray knownTimeZoneNames()
public static NSTimeZone localTimeZone()
See Also: defaultTimeZone, setDefaultTimeZone
public static synchronized void resetSystemTimeZone()
public static synchronized void setDefault(java.util.TimeZone zone)
public static synchronized void setDefaultTimeZone(NSTimeZone aTimeZone)
See Also: defaultTimeZone, localTimeZone
public static synchronized NSTimeZone systemTimeZone()
public static synchronized NSTimeZone timeZoneForSecondsFromGMT(int seconds)
See Also: timeZoneWithName
public static synchronized NSTimeZone timeZoneWithName( String aTimeZoneName, boolean trybbreviation)
false
, this method searches the time zone information directory for matching names. If tryAbbreviation is true
, this method attempts to resolve the abbreviation to a name using the abbreviation dictionary. Returns null
if there is no match on the name.
See Also: timeZoneForSecondsFromGMT, knownTimeZoneNames
public static synchronized NSTimeZone timeZoneWithNameAndData( String aTimeZoneName, NSData data)
public String abbreviation()
public String abbreviationForTimestamp(NSTimestamp aTimestamp)
public Class classForCoder()
See Also: classForCoder (NSCoding)
public Object clone()
public NSData data()
public void encodeWithCoder(NSCoder coder)
public boolean equals(Object anObject)
true
if anObject is an NSTimeZone and its contents are equal to the receiver's or false
otherwise. If you know that anObject is an NSTimestamp, use the more efficient method isEqualToTimeZone instead.
public String getDisplayName( boolean daylight, int style, java.util.Locale locale)
public String getID()
public int getOffset( int era, int year, int month, int day, int dayOfWeek, int milliseconds)
public int getRawOffset()
public synchronized int hashCode()
public boolean hasSameRules(java.util.TimeZone other)
true
if other is the same as the receiver (as determined by equals.).
public boolean inDaylightTime(java.util.Date date)
public boolean isDaylightSavingTime()
true
if the time zone is currently using Daylight Savings Time. This method invokes isDaylightSavingTimeForTimestamp with the current date as the argument.
public boolean isDaylightSavingTimeForTimestamp(NSTimestamp aTimestamp)
true
if the time zone uses Daylight Savings Time at the date specified by aTimestamp.
public boolean isEqualToTimeZone(NSTimeZone aTimeZone)
true
if aTimeZone and the receiving time zone have the same name and data.
public String name()
public void readExternal(java.io.ObjectInput input) throws java.io.IOException,ClassNotFoundException
public Object readResolve() throws java.io.ObjectStreamException
public int secondsFromGMT()
public int secondsFromGMTForTimestamp(NSTimestamp aTimestamp)
public void setID(String ID)
public void setRawOffset(int offsetMillis)
public String toString()
public boolean useDaylightTime()
public void writeExternal( java.io.ObjectOutput output) throws java.io.IOException
public static final String
SystemTimeZoneDidChangeNotification
;
© 2001 Apple Computer, Inc. (Last Published April 17, 2001)