Java Doc for Calendar.java in  » Apache-Harmony-Java-SE » java-package » java » 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 » Apache Harmony Java SE » java package » java.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.Calendar

All known Subclasses:   java.util.GregorianCalendar,
Calendar
abstract public class Calendar implements Serializable,Cloneable,Comparable<Calendar>(Code)
Calendar is an abstract class which provides the conversion between Dates and integer calendar fields, such as the month, year or minute. Subclasses of this class implement a specific calendar type, such as the gregorian calendar.
See Also:   Date
See Also:   GregorianCalendar
See Also:   TimeZone


Field Summary
final public static  intERAYEARMONTHWEEK_OF_YEARWEEK_OF_MONTHDATEDAY_OF_MONTHDAY_OF_YEARDAY_OF_WEEKDAY_OF_WEEK_IN_MONTHAM_PMHOURHOUR_OF_DAYMINUTESECONDMILLISECONDZONE_OFFSETDST_OFFSETFIELD_COUNTAMPM
    
final public static  intJANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUSTSEPTEMBEROCTOBERNOVEMBERDECEMBERUNDECIMBERSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAY
    
protected  booleanareFieldsSet
     Set to true when the calendar fields have been set from the time, set to false when a field is changed and the fields must be recomputed.
protected  int[]fields
     An integer array of calendar fields.
protected  boolean[]isSet
    
protected  booleanisTimeSet
     Set to true when the time has been set, set to false when a field is changed and the time must be recomputed.
transient  intlastDateFieldSet
    
transient  intlastTimeFieldSet
    
protected  longtime
     The time in milliseconds since January 1, 1970.

Constructor Summary
protected  Calendar()
     Initializes this Calendar instance using the default TimeZone and Locale.
 Calendar(TimeZone timezone)
    
protected  Calendar(TimeZone timezone, Locale locale)
     Initializes this Calendar instance using the specified TimeZone and Locale.

Method Summary
abstract public  voidadd(int field, int value)
     Adds the specified amount to a Calendar field.
public  booleanafter(Object calendar)
     Answers if the Date specified by this Calendar instance is after the Date specified by the parameter.
public  booleanbefore(Object calendar)
     Answers if the Date specified by this Calendar instance is before the Date specified by the parameter.
final public  voidclear()
     Clears all of the fields of this Calendar.
final public  voidclear(int field)
     Clears the specified field to zero.
public  Objectclone()
     Answers a new Calendar with the same properties.
public  intcompareTo(Calendar anotherCalendar)
     Compares the times of the two Calendars, which represent the milliseconds from the January 1, 1970 00:00:00.000 GMT (Gregorian).
Parameters:
  anotherCalendar - another calendar that is compared with.
protected  voidcomplete()
     Computes the time from the fields if the time has not already been set.
abstract protected  voidcomputeFields()
     Computes the Calendar fields from the time.
abstract protected  voidcomputeTime()
     Computes the time from the Calendar fields.
public  booleanequals(Object object)
     Compares the specified object to this Calendar and answer if they are equal.
public  intget(int field)
     Gets the value of the specified field after computing the field values from the time if required.
public  intgetActualMaximum(int field)
     Gets the maximum value of the specified field for the current date.
public  intgetActualMinimum(int field)
     Gets the minimum value of the specified field for the current date.
public static synchronized  Locale[]getAvailableLocales()
     Gets the list of installed Locales which support Calendar.
public  intgetFirstDayOfWeek()
     Gets the first day of the week for this Calendar.
abstract public  intgetGreatestMinimum(int field)
     Gets the greatest minimum value of the specified field.
public static synchronized  CalendargetInstance()
     Constructs a new instance of the Calendar subclass appropriate for the default Locale.
public static synchronized  CalendargetInstance(Locale locale)
     Constructs a new instance of the Calendar subclass appropriate for the specified Locale.
public static synchronized  CalendargetInstance(TimeZone timezone)
     Constructs a new instance of the Calendar subclass appropriate for the default Locale, using the specified TimeZone.
public static synchronized  CalendargetInstance(TimeZone timezone, Locale locale)
     Constructs a new instance of the Calendar subclass appropriate for the specified Locale.
abstract public  intgetLeastMaximum(int field)
     Gets the smallest maximum value of the specified field.
abstract public  intgetMaximum(int field)
     Gets the greatest maximum value of the specified field.
public  intgetMinimalDaysInFirstWeek()
     Gets the minimal days in the first week of the year.
abstract public  intgetMinimum(int field)
     Gets the smallest minimum value of the specified field.
final public  DategetTime()
     Gets the time of this Calendar as a Date object.
public  longgetTimeInMillis()
     Computes the time from the fields if required and answers the time.
public  TimeZonegetTimeZone()
     Gets the timezone of this Calendar.
public  inthashCode()
     Answers an integer hash code for the receiver.
final protected  intinternalGet(int field)
     Gets the value of the specified field without recomputing.
public  booleanisLenient()
     Answers if this Calendar accepts field values which are outside the valid range for the field.
final public  booleanisSet(int field)
     Answers if the specified field is set.
public  voidroll(int field, int value)
     Adds the specified amount the specified field and wrap the value of the field when it goes beyond the maximum or minimum value for the current date.
abstract public  voidroll(int field, boolean increment)
     Increment or decrement the specified field and wrap the value of the field when it goes beyond the maximum or minimum value for the current date.
public  voidset(int field, int value)
     Sets a field to the specified value.
final public  voidset(int year, int month, int day)
     Sets the year, month and day of the month fields.
final public  voidset(int year, int month, int day, int hourOfDay, int minute)
     Sets the year, month, day of the month, hour of day and minute fields.
final public  voidset(int year, int month, int day, int hourOfDay, int minute, int second)
     Sets the year, month, day of the month, hour of day, minute and second fields.
public  voidsetFirstDayOfWeek(int value)
     Sets the first day of the week for this Calendar.
public  voidsetLenient(boolean value)
     Sets this Calendar to accept field values which are outside the valid range for the field.
public  voidsetMinimalDaysInFirstWeek(int value)
     Sets the minimal days in the first week of the year.
final public  voidsetTime(Date date)
     Sets the time of this Calendar.
public  voidsetTimeInMillis(long milliseconds)
     Sets the time of this Calendar.
Parameters:
  milliseconds - the time as the number of milliseconds since Jan.
public  voidsetTimeZone(TimeZone timezone)
     Sets the timezone used by this Calendar.
public  StringtoString()
     Answers the string representation of this Calendar.

Field Detail
ERAYEARMONTHWEEK_OF_YEARWEEK_OF_MONTHDATEDAY_OF_MONTHDAY_OF_YEARDAY_OF_WEEKDAY_OF_WEEK_IN_MONTHAM_PMHOURHOUR_OF_DAYMINUTESECONDMILLISECONDZONE_OFFSETDST_OFFSETFIELD_COUNTAMPM
final public static int ERAYEARMONTHWEEK_OF_YEARWEEK_OF_MONTHDATEDAY_OF_MONTHDAY_OF_YEARDAY_OF_WEEKDAY_OF_WEEK_IN_MONTHAM_PMHOURHOUR_OF_DAYMINUTESECONDMILLISECONDZONE_OFFSETDST_OFFSETFIELD_COUNTAMPM(Code)



JANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUSTSEPTEMBEROCTOBERNOVEMBERDECEMBERUNDECIMBERSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAY
final public static int JANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUSTSEPTEMBEROCTOBERNOVEMBERDECEMBERUNDECIMBERSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAY(Code)



areFieldsSet
protected boolean areFieldsSet(Code)
Set to true when the calendar fields have been set from the time, set to false when a field is changed and the fields must be recomputed.



fields
protected int[] fields(Code)
An integer array of calendar fields.



isSet
protected boolean[] isSet(Code)



isTimeSet
protected boolean isTimeSet(Code)
Set to true when the time has been set, set to false when a field is changed and the time must be recomputed.



lastDateFieldSet
transient int lastDateFieldSet(Code)



lastTimeFieldSet
transient int lastTimeFieldSet(Code)



time
protected long time(Code)
The time in milliseconds since January 1, 1970.




Constructor Detail
Calendar
protected Calendar()(Code)
Initializes this Calendar instance using the default TimeZone and Locale.



Calendar
Calendar(TimeZone timezone)(Code)



Calendar
protected Calendar(TimeZone timezone, Locale locale)(Code)
Initializes this Calendar instance using the specified TimeZone and Locale.
Parameters:
  timezone - the timezone
Parameters:
  locale - the locale




Method Detail
add
abstract public void add(int field, int value)(Code)
Adds the specified amount to a Calendar field.
Parameters:
  field - the Calendar field to modify
Parameters:
  value - the amount to add to the field
exception:
  IllegalArgumentException - when the specified field is DST_OFFSET or ZONE_OFFSET.



after
public boolean after(Object calendar)(Code)
Answers if the Date specified by this Calendar instance is after the Date specified by the parameter. The comparison is not dependent on the time zones of the Calendars.
Parameters:
  calendar - the Calendar instance to compare true when this Calendar is after calendar, false otherwise
exception:
  IllegalArgumentException - when the time is not set and the time cannot be computedfrom the current field values



before
public boolean before(Object calendar)(Code)
Answers if the Date specified by this Calendar instance is before the Date specified by the parameter. The comparison is not dependent on the time zones of the Calendars.
Parameters:
  calendar - the Calendar instance to compare true when this Calendar is before calendar, false otherwise
exception:
  IllegalArgumentException - when the time is not set and the time cannot be computedfrom the current field values



clear
final public void clear()(Code)
Clears all of the fields of this Calendar. All fields are initialized to zero.



clear
final public void clear(int field)(Code)
Clears the specified field to zero.
Parameters:
  field - the field to clear



clone
public Object clone()(Code)
Answers a new Calendar with the same properties. a shallow copy of this Calendar
See Also:   java.lang.Cloneable



compareTo
public int compareTo(Calendar anotherCalendar)(Code)
Compares the times of the two Calendars, which represent the milliseconds from the January 1, 1970 00:00:00.000 GMT (Gregorian).
Parameters:
  anotherCalendar - another calendar that is compared with. 0 if the times of the two calendar are equal, -1 if the time ofthis calendar is before the other one, 1 if the time of thiscalendar is after the other one.
throws:
  NullPointerException - if the argument of calendar is null.
throws:
  IllegalArgumentException - if the argument of the calendar does not include a valid timevalue.



complete
protected void complete()(Code)
Computes the time from the fields if the time has not already been set. Computes the fields from the time if the fields are not already set.
exception:
  IllegalArgumentException - when the time is not set and the time cannot be computedfrom the current field values



computeFields
abstract protected void computeFields()(Code)
Computes the Calendar fields from the time.



computeTime
abstract protected void computeTime()(Code)
Computes the time from the Calendar fields.
exception:
  IllegalArgumentException - when the time cannot be computed from the current fieldvalues



equals
public boolean equals(Object object)(Code)
Compares the specified object to this Calendar and answer if they are equal. The object must be an instance of Calendar and have the same properties.
Parameters:
  object - the object to compare with this object true if the specified object is equal to this Calendar, falseotherwise



get
public int get(int field)(Code)
Gets the value of the specified field after computing the field values from the time if required.
Parameters:
  field - the field the value of the specified field
exception:
  IllegalArgumentException - when the fields are not set, the time is not set, and thetime cannot be computed from the current field values



getActualMaximum
public int getActualMaximum(int field)(Code)
Gets the maximum value of the specified field for the current date.
Parameters:
  field - the field the maximum value of the specified field



getActualMinimum
public int getActualMinimum(int field)(Code)
Gets the minimum value of the specified field for the current date.
Parameters:
  field - the field the minimum value of the specified field



getAvailableLocales
public static synchronized Locale[] getAvailableLocales()(Code)
Gets the list of installed Locales which support Calendar. an array of Locale



getFirstDayOfWeek
public int getFirstDayOfWeek()(Code)
Gets the first day of the week for this Calendar. a Calendar day of the week



getGreatestMinimum
abstract public int getGreatestMinimum(int field)(Code)
Gets the greatest minimum value of the specified field.
Parameters:
  field - the field the greatest minimum value of the specified field



getInstance
public static synchronized Calendar getInstance()(Code)
Constructs a new instance of the Calendar subclass appropriate for the default Locale. a Calendar subclass instance set to the current date and time inthe default timezone



getInstance
public static synchronized Calendar getInstance(Locale locale)(Code)
Constructs a new instance of the Calendar subclass appropriate for the specified Locale.
Parameters:
  locale - the locale to use a Calendar subclass instance set to the current date and time



getInstance
public static synchronized Calendar getInstance(TimeZone timezone)(Code)
Constructs a new instance of the Calendar subclass appropriate for the default Locale, using the specified TimeZone.
Parameters:
  timezone - the timezone to use a Calendar subclass instance set to the current date and time inthe specified timezone



getInstance
public static synchronized Calendar getInstance(TimeZone timezone, Locale locale)(Code)
Constructs a new instance of the Calendar subclass appropriate for the specified Locale.
Parameters:
  timezone - the timezone to use
Parameters:
  locale - the locale to use a Calendar subclass instance set to the current date and time inthe specified timezone



getLeastMaximum
abstract public int getLeastMaximum(int field)(Code)
Gets the smallest maximum value of the specified field.
Parameters:
  field - the field the smallest maximum value of the specified field



getMaximum
abstract public int getMaximum(int field)(Code)
Gets the greatest maximum value of the specified field.
Parameters:
  field - the field the greatest maximum value of the specified field



getMinimalDaysInFirstWeek
public int getMinimalDaysInFirstWeek()(Code)
Gets the minimal days in the first week of the year. the minimal days in the first week of the year



getMinimum
abstract public int getMinimum(int field)(Code)
Gets the smallest minimum value of the specified field.
Parameters:
  field - the field the smallest minimum value of the specified field



getTime
final public Date getTime()(Code)
Gets the time of this Calendar as a Date object. a new Date initialized to the time of this Calendar
exception:
  IllegalArgumentException - when the time is not set and the time cannot be computedfrom the current field values



getTimeInMillis
public long getTimeInMillis()(Code)
Computes the time from the fields if required and answers the time. the time of this Calendar
exception:
  IllegalArgumentException - when the time is not set and the time cannot be computedfrom the current field values



getTimeZone
public TimeZone getTimeZone()(Code)
Gets the timezone of this Calendar. the timezone used by this Calendar



hashCode
public int hashCode()(Code)
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method. the receiver's hash
See Also:   Calendar.equals



internalGet
final protected int internalGet(int field)(Code)
Gets the value of the specified field without recomputing.
Parameters:
  field - the field the value of the specified field



isLenient
public boolean isLenient()(Code)
Answers if this Calendar accepts field values which are outside the valid range for the field. true if this Calendar is lenient, false otherwise



isSet
final public boolean isSet(int field)(Code)
Answers if the specified field is set.
Parameters:
  field - a calendar field true if the specified field is set, false otherwise



roll
public void roll(int field, int value)(Code)
Adds the specified amount the specified field and wrap the value of the field when it goes beyond the maximum or minimum value for the current date. Other fields will be adjusted as required to maintain a consistent date.
Parameters:
  field - the field to roll
Parameters:
  value - the amount to add



roll
abstract public void roll(int field, boolean increment)(Code)
Increment or decrement the specified field and wrap the value of the field when it goes beyond the maximum or minimum value for the current date. Other fields will be adjusted as required to maintain a consistent date.
Parameters:
  field - the field to roll
Parameters:
  increment - true to increment the field, false to decrement



set
public void set(int field, int value)(Code)
Sets a field to the specified value.
Parameters:
  field - the Calendar field to modify
Parameters:
  value - the value



set
final public void set(int year, int month, int day)(Code)
Sets the year, month and day of the month fields.
Parameters:
  year - the year
Parameters:
  month - the month
Parameters:
  day - the day of the month



set
final public void set(int year, int month, int day, int hourOfDay, int minute)(Code)
Sets the year, month, day of the month, hour of day and minute fields.
Parameters:
  year - the year
Parameters:
  month - the month
Parameters:
  day - the day of the month
Parameters:
  hourOfDay - the hour of day
Parameters:
  minute - the minute



set
final public void set(int year, int month, int day, int hourOfDay, int minute, int second)(Code)
Sets the year, month, day of the month, hour of day, minute and second fields.
Parameters:
  year - the year
Parameters:
  month - the month
Parameters:
  day - the day of the month
Parameters:
  hourOfDay - the hour of day
Parameters:
  minute - the minute
Parameters:
  second - the second



setFirstDayOfWeek
public void setFirstDayOfWeek(int value)(Code)
Sets the first day of the week for this Calendar.
Parameters:
  value - a Calendar day of the week



setLenient
public void setLenient(boolean value)(Code)
Sets this Calendar to accept field values which are outside the valid range for the field.
Parameters:
  value - a boolean value



setMinimalDaysInFirstWeek
public void setMinimalDaysInFirstWeek(int value)(Code)
Sets the minimal days in the first week of the year.
Parameters:
  value - the minimal days in the first week of the year



setTime
final public void setTime(Date date)(Code)
Sets the time of this Calendar.
Parameters:
  date - a Date object



setTimeInMillis
public void setTimeInMillis(long milliseconds)(Code)
Sets the time of this Calendar.
Parameters:
  milliseconds - the time as the number of milliseconds since Jan. 1, 1970



setTimeZone
public void setTimeZone(TimeZone timezone)(Code)
Sets the timezone used by this Calendar.
Parameters:
  timezone - a TimeZone



toString
public String toString()(Code)
Answers the string representation of this Calendar. the string representation of this Calendar



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) 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.