Java Doc for TimeZone.java in  » Internationalization-Localization » icu4j » com » ibm » icu » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » icu4j » com.ibm.icu.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ibm.icu.util.TimeZone

All known Subclasses:   com.ibm.icu.impl.JDKTimeZone,  com.ibm.icu.impl.OlsonTimeZone,
TimeZone
abstract public class TimeZone implements Serializable,Cloneable(Code)
TimeZone represents a time zone offset, and also figures out daylight savings.

Typically, you get a TimeZone using getDefault which creates a TimeZone based on the time zone where the program is running. For example, for a program running in Japan, getDefault creates a TimeZone object based on Japanese Standard Time.

You can also get a TimeZone using getTimeZone along with a time zone ID. For instance, the time zone ID for the U.S. Pacific Time zone is "America/Los_Angeles". So, you can get a U.S. Pacific Time TimeZone object with:

 TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
 
You can use getAvailableIDs method to iterate through all the supported time zone IDs. You can then choose a supported ID to get a TimeZone. If the time zone you want is not represented by one of the supported IDs, then you can create a custom time zone ID with the following syntax:
 GMT[+|-]hh[[:]mm]
 
For example, you might specify GMT+14:00 as a custom time zone ID. The TimeZone that is returned when you specify a custom time zone ID does not include daylight savings time.

For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them.
See Also:   Calendar
See Also:   GregorianCalendar
See Also:   SimpleTimeZone
author:
   Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu



Field Summary
final static  int[][]GREGORIAN_MONTH_COUNT
     For each month, the days in a non-leap year before the start the of month, and the days in a leap year before the start of the month.
final public static  intLONG
    
final protected static  intMILLIS_PER_DAY
     The number of milliseconds in one day.
final protected static  intMILLIS_PER_HOUR
     The number of milliseconds in an hour.
final public static  intSHORT
    

Constructor Summary
public  TimeZone()
     Default constructor.

Method Summary
public  Objectclone()
    
static  voidcomputeGregorianFields(long day, int fields)
     Compute the Gregorian calendar year, month, and day of month from the epoch day, and return them in the given array.
public static  intcountEquivalentIDs(String id)
     Returns the number of IDs in the equivalency group that includes the given ID.
public  booleanequals(Object obj)
     Return true if obj is a TimeZone with the same class and ID as this.
static  longfloorDivide(long numerator, long denominator)
     Divide two long integers, returning the floor of the quotient.
static  intfloorDivide(long numerator, int denominator, int[] remainder)
     Divide two integers, returning the floor of the quotient, and the modulus remainder.

Unlike the built-in division, this is mathematically well-behaved. E.g., -1/4 => 0 and -1%4 => -1, but floorDivide(-1,4) => -1 with remainder[0] => 3. TODO: This duplicates a method in Calendar; clean up and consolidate in ICU 3.0.
Parameters:
  numerator - the numerator
Parameters:
  denominator - a divisor which must be > 0
Parameters:
  remainder - an array of at least one element in which the valuenumerator mod denominator is returned.

public static  String[]getAvailableIDs(int rawOffset)
     Return a new String array containing all system TimeZone IDs with the given raw offset from GMT.
public static  String[]getAvailableIDs(String country)
     Return a new String array containing all system TimeZone IDs associated with the given country.
public static  String[]getAvailableIDs()
     Return a new String array containing all system TimeZone IDs.
public  intgetDSTSavings()
     Returns the amount of time to be added to local standard time to get local wall clock time.

The default implementation always returns 3600000 milliseconds (i.e., one hour) if this time zone observes Daylight Saving Time.

public static synchronized  TimeZonegetDefault()
     Gets the default TimeZone for this host.
final public  StringgetDisplayName()
     Returns a name of this time zone suitable for presentation to the user in the default locale.
final public  StringgetDisplayName(Locale locale)
     Returns a name of this time zone suitable for presentation to the user in the specified locale. This method returns the long generic name. If the display name is not available for the locale, a fallback based on the country, city, or time zone id will be used.
Parameters:
  locale - the locale in which to supply the display name.
final public  StringgetDisplayName(ULocale locale)
     Returns a name of this time zone suitable for presentation to the user in the specified locale. This method returns the long name, not including daylight savings. If the display name is not available for the locale, a fallback based on the country, city, or time zone id will be used.
Parameters:
  locale - the ulocale in which to supply the display name.
final public  StringgetDisplayName(boolean daylight, int style)
     Returns a name of this time zone suitable for presentation to the user in the default locale.
public  StringgetDisplayName(boolean daylight, int style, Locale locale)
     Returns a name of this time zone suitable for presentation to the user in the specified locale. If the display name is not available for the locale, then this method returns a string in the format GMT[+-]hh:mm.
Parameters:
  daylight - if true, return the daylight savings name.
Parameters:
  style - either LONG or SHORT
Parameters:
  locale - the locale in which to supply the display name.
public  StringgetDisplayName(boolean daylight, int style, ULocale locale)
     Returns a name of this time zone suitable for presentation to the user in the specified locale. If the display name is not available for the locale, then this method returns a string in the format GMT[+-]hh:mm.
Parameters:
  daylight - if true, return the daylight savings name.
Parameters:
  style - either LONG or SHORT
Parameters:
  locale - the locale in which to supply the display name.
public static  StringgetEquivalentID(String id, int index)
     Returns an ID in the equivalency group that includes the given ID.
public  StringgetID()
     Gets the ID of this time zone.
abstract public  intgetOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds)
     Gets the time zone offset, for current date, modified in case of daylight savings.
public  intgetOffset(long date)
     Returns the offset of this time zone from UTC at the specified date.
public  voidgetOffset(long date, boolean local, int[] offsets)
     Returns the time zone raw and GMT offset for the given moment in time.
abstract public  intgetRawOffset()
     Gets unmodified offset, NOT modified in case of daylight savings.
public static synchronized  TimeZonegetTimeZone(String ID)
     Gets the TimeZone for the given ID.
Parameters:
  ID - the ID for a TimeZone, either an abbreviationsuch as "PST", a full name such as "America/Los_Angeles", or a customID such as "GMT-8:00".
public  booleanhasSameRules(TimeZone other)
     Returns true if this zone has the same rule and offset as another zone. That is, if this zone differs only in ID, if at all.
public  inthashCode()
     Return the hash code.
abstract public  booleaninDaylightTime(Date date)
     Queries if the given date is in daylight savings time in this time zone.
Parameters:
  date - the given Date.
public static synchronized  voidsetDefault(TimeZone tz)
     Sets the TimeZone that is returned by the getDefault method.
public  voidsetID(String ID)
     Sets the time zone ID.
abstract public  voidsetRawOffset(int offsetMillis)
     Sets the base time zone offset to GMT.
abstract public  booleanuseDaylightTime()
     Queries if this time zone uses daylight savings time.

Field Detail
GREGORIAN_MONTH_COUNT
final static int[][] GREGORIAN_MONTH_COUNT(Code)
For each month, the days in a non-leap year before the start the of month, and the days in a leap year before the start of the month. TODO: This duplicates data in Calendar.java; clean up and consolidate in ICU 3.0.



LONG
final public static int LONG(Code)
A style specifier for getDisplayName() indicating a long name, such as "Pacific Standard Time."
See Also:   TimeZone.SHORT



MILLIS_PER_DAY
final protected static int MILLIS_PER_DAY(Code)
The number of milliseconds in one day.



MILLIS_PER_HOUR
final protected static int MILLIS_PER_HOUR(Code)
The number of milliseconds in an hour.



SHORT
final public static int SHORT(Code)
A style specifier for getDisplayName() indicating a short name, such as "PST."
See Also:   TimeZone.LONG




Constructor Detail
TimeZone
public TimeZone()(Code)
Default constructor. (For invocation by subclass constructors, typically implicit.)




Method Detail
clone
public Object clone()(Code)
Overrides Cloneable



computeGregorianFields
static void computeGregorianFields(long day, int fields)(Code)
Compute the Gregorian calendar year, month, and day of month from the epoch day, and return them in the given array. TODO: This duplicates a method in Calendar; clean up and consolidate in ICU 3.0.



countEquivalentIDs
public static int countEquivalentIDs(String id)(Code)
Returns the number of IDs in the equivalency group that includes the given ID. An equivalency group contains zones that have the same GMT offset and rules.

The returned count includes the given ID; it is always >= 1 for valid IDs. The given ID must be a system time zone. If it is not, returns zero.
Parameters:
  id - a system time zone ID the number of zones in the equivalency group containing'id', or zero if 'id' is not a valid system ID
See Also:   TimeZone.getEquivalentID




equals
public boolean equals(Object obj)(Code)
Return true if obj is a TimeZone with the same class and ID as this. true if obj is a TimeZone with the same class and ID as this
Parameters:
  obj - the object to compare against



floorDivide
static long floorDivide(long numerator, long denominator)(Code)
Divide two long integers, returning the floor of the quotient.

Unlike the built-in division, this is mathematically well-behaved. E.g., -1/4 => 0 but floorDivide(-1,4) => -1. TODO: This duplicates a method in Calendar; clean up and consolidate in ICU 3.0.
Parameters:
  numerator - the numerator
Parameters:
  denominator - a divisor which must be > 0 the floor of the quotient.




floorDivide
static int floorDivide(long numerator, int denominator, int[] remainder)(Code)
Divide two integers, returning the floor of the quotient, and the modulus remainder.

Unlike the built-in division, this is mathematically well-behaved. E.g., -1/4 => 0 and -1%4 => -1, but floorDivide(-1,4) => -1 with remainder[0] => 3. TODO: This duplicates a method in Calendar; clean up and consolidate in ICU 3.0.
Parameters:
  numerator - the numerator
Parameters:
  denominator - a divisor which must be > 0
Parameters:
  remainder - an array of at least one element in which the valuenumerator mod denominator is returned. Unlike numerator% denominator, this will always be non-negative. the floor of the quotient.




getAvailableIDs
public static String[] getAvailableIDs(int rawOffset)(Code)
Return a new String array containing all system TimeZone IDs with the given raw offset from GMT. These IDs may be passed to get() to construct the corresponding TimeZone object.
Parameters:
  rawOffset - the offset in milliseconds from GMT an array of IDs for system TimeZones with the givenraw offset. If there are none, return a zero-length array.



getAvailableIDs
public static String[] getAvailableIDs(String country)(Code)
Return a new String array containing all system TimeZone IDs associated with the given country. These IDs may be passed to get() to construct the corresponding TimeZone object.
Parameters:
  country - a two-letter ISO 3166 country code, or nullto return zones not associated with any country an array of IDs for system TimeZones in the givencountry. If there are none, return a zero-length array.



getAvailableIDs
public static String[] getAvailableIDs()(Code)
Return a new String array containing all system TimeZone IDs. These IDs (and only these IDs) may be passed to get() to construct the corresponding TimeZone object. an array of all system TimeZone IDs



getDSTSavings
public int getDSTSavings()(Code)
Returns the amount of time to be added to local standard time to get local wall clock time.

The default implementation always returns 3600000 milliseconds (i.e., one hour) if this time zone observes Daylight Saving Time. Otherwise, 0 (zero) is returned.

If an underlying TimeZone implementation subclass supports historical Daylight Saving Time changes, this method returns the known latest daylight saving value. the amount of saving time in milliseconds




getDefault
public static synchronized TimeZone getDefault()(Code)
Gets the default TimeZone for this host. The source of the default TimeZone may vary with implementation. a default TimeZone.



getDisplayName
final public String getDisplayName()(Code)
Returns a name of this time zone suitable for presentation to the user in the default locale. This method returns the long generic name. If the display name is not available for the locale, a fallback based on the country, city, or time zone id will be used. the human-readable name of this time zone in the default locale.



getDisplayName
final public String getDisplayName(Locale locale)(Code)
Returns a name of this time zone suitable for presentation to the user in the specified locale. This method returns the long generic name. If the display name is not available for the locale, a fallback based on the country, city, or time zone id will be used.
Parameters:
  locale - the locale in which to supply the display name. the human-readable name of this time zone in the given localeor in the default locale if the given locale is not recognized.



getDisplayName
final public String getDisplayName(ULocale locale)(Code)
Returns a name of this time zone suitable for presentation to the user in the specified locale. This method returns the long name, not including daylight savings. If the display name is not available for the locale, a fallback based on the country, city, or time zone id will be used.
Parameters:
  locale - the ulocale in which to supply the display name. the human-readable name of this time zone in the given localeor in the default ulocale if the given ulocale is not recognized.



getDisplayName
final public String getDisplayName(boolean daylight, int style)(Code)
Returns a name of this time zone suitable for presentation to the user in the default locale. If the display name is not available for the locale, then this method returns a string in the format GMT[+-]hh:mm.
Parameters:
  daylight - if true, return the daylight savings name.
Parameters:
  style - either LONG or SHORT the human-readable name of this time zone in the default locale.



getDisplayName
public String getDisplayName(boolean daylight, int style, Locale locale)(Code)
Returns a name of this time zone suitable for presentation to the user in the specified locale. If the display name is not available for the locale, then this method returns a string in the format GMT[+-]hh:mm.
Parameters:
  daylight - if true, return the daylight savings name.
Parameters:
  style - either LONG or SHORT
Parameters:
  locale - the locale in which to supply the display name. the human-readable name of this time zone in the given localeor in the default locale if the given locale is not recognized.
exception:
  IllegalArgumentException - style is invalid.



getDisplayName
public String getDisplayName(boolean daylight, int style, ULocale locale)(Code)
Returns a name of this time zone suitable for presentation to the user in the specified locale. If the display name is not available for the locale, then this method returns a string in the format GMT[+-]hh:mm.
Parameters:
  daylight - if true, return the daylight savings name.
Parameters:
  style - either LONG or SHORT
Parameters:
  locale - the locale in which to supply the display name. the human-readable name of this time zone in the given localeor in the default locale if the given locale is not recognized.
exception:
  IllegalArgumentException - style is invalid.



getEquivalentID
public static String getEquivalentID(String id, int index)(Code)
Returns an ID in the equivalency group that includes the given ID. An equivalency group contains zones that have the same GMT offset and rules.

The given index must be in the range 0..n-1, where n is the value returned by countEquivalentIDs(id). For some value of 'index', the returned value will be equal to the given id. If the given id is not a valid system time zone, or if 'index' is out of range, then returns an empty string.
Parameters:
  id - a system time zone ID
Parameters:
  index - a value from 0 to n-1, where n is the valuereturned by countEquivalentIDs(id) the ID of the index-th zone in the equivalency groupcontaining 'id', or an empty string if 'id' is not a validsystem ID or 'index' is out of range
See Also:   TimeZone.countEquivalentIDs




getID
public String getID()(Code)
Gets the ID of this time zone. the ID of this time zone.



getOffset
abstract public int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds)(Code)
Gets the time zone offset, for current date, modified in case of daylight savings. This is the offset to add *to* UTC to get local time.
Parameters:
  era - the era of the given date.
Parameters:
  year - the year in the given date.
Parameters:
  month - the month in the given date.Month is 0-based. e.g., 0 for January.
Parameters:
  day - the day-in-month of the given date.
Parameters:
  dayOfWeek - the day-of-week of the given date.
Parameters:
  milliseconds - the millis in day in standard local time. the offset to add *to* GMT to get local time.



getOffset
public int getOffset(long date)(Code)
Returns the offset of this time zone from UTC at the specified date. If Daylight Saving Time is in effect at the specified date, the offset value is adjusted with the amount of daylight saving.
Parameters:
  date - the date represented in milliseconds since January 1, 1970 00:00:00 GMT the amount of time in milliseconds to add to UTC to get local time.
See Also:   Calendar.ZONE_OFFSET
See Also:   Calendar.DST_OFFSET
See Also:   TimeZone.getOffset(long,boolean,int[])



getOffset
public void getOffset(long date, boolean local, int[] offsets)(Code)
Returns the time zone raw and GMT offset for the given moment in time. Upon return, local-millis = GMT-millis + rawOffset + dstOffset. All computations are performed in the proleptic Gregorian calendar. The default implementation in the TimeZone class delegates to the 8-argument getOffset().
Parameters:
  date - moment in time for which to return offsets, inunits of milliseconds from January 1, 1970 0:00 GMT, either GMTtime or local wall time, depending on `local'.
Parameters:
  local - if true, `date' is local wall time; otherwise itis in GMT time.
Parameters:
  offsets - output parameter to receive the raw offset, thatis, the offset not including DST adjustments, in offsets[0],and the DST offset, that is, the offset to be added to`rawOffset' to obtain the total offset between local and GMTtime, in offsets[1]. If DST is not in effect, the DST offset iszero; otherwise it is a positive value, typically one hour.



getRawOffset
abstract public int getRawOffset()(Code)
Gets unmodified offset, NOT modified in case of daylight savings. This is the offset to add *to* UTC to get local time. the unmodified offset to add *to* UTC to get local time.



getTimeZone
public static synchronized TimeZone getTimeZone(String ID)(Code)
Gets the TimeZone for the given ID.
Parameters:
  ID - the ID for a TimeZone, either an abbreviationsuch as "PST", a full name such as "America/Los_Angeles", or a customID such as "GMT-8:00". Note that the support of abbreviations isfor JDK 1.1.x compatibility only and full names should be used. the specified TimeZone, or the GMT zone if the given IDcannot be understood.



hasSameRules
public boolean hasSameRules(TimeZone other)(Code)
Returns true if this zone has the same rule and offset as another zone. That is, if this zone differs only in ID, if at all. Returns false if the other zone is null.
Parameters:
  other - the TimeZone object to be compared with true if the other zone is not null and is the same as this one,with the possible exception of the ID



hashCode
public int hashCode()(Code)
Return the hash code. the hash code



inDaylightTime
abstract public boolean inDaylightTime(Date date)(Code)
Queries if the given date is in daylight savings time in this time zone.
Parameters:
  date - the given Date. true if the given date is in daylight savings time,false, otherwise.



setDefault
public static synchronized void setDefault(TimeZone tz)(Code)
Sets the TimeZone that is returned by the getDefault method. If zone is null, reset the default to the value it had originally when the VM first started.
Parameters:
  tz - the new default time zone



setID
public void setID(String ID)(Code)
Sets the time zone ID. This does not change any other data in the time zone object.
Parameters:
  ID - the new time zone ID.



setRawOffset
abstract public void setRawOffset(int offsetMillis)(Code)
Sets the base time zone offset to GMT. This is the offset to add *to* UTC to get local time.
Parameters:
  offsetMillis - the given base time zone offset to GMT.



useDaylightTime
abstract public boolean useDaylightTime()(Code)
Queries if this time zone uses daylight savings time. true if this time zone uses daylight savings time,false, otherwise.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.