Java Doc for Calendar.java in  » 6.0-JDK-Modules » j2me » 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 » 6.0 JDK Modules » j2me » java.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.Calendar

All known Subclasses:   java.util.GregorianCalendar,  com.sun.cldc.util.j2me.CalendarImpl,
Calendar
abstract public class Calendar (Code)
Calendar is an abstract base class for converting between a Date object and a set of integer fields such as YEAR, MONTH, DAY, HOUR, and so on. (A Date object represents a specific instant in time with millisecond precision. See Date for information about the Date class.)

Subclasses of Calendar interpret a Date according to the rules of a specific calendar system.

Like other locale-sensitive classes, Calendar provides a class method, getInstance, for getting a generally useful object of this type.

 Calendar rightNow = Calendar.getInstance();
 

A Calendar object can produce all the time field values needed to implement the date-time formatting for a particular language and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).

When computing a Date from time fields, there may be insufficient information to compute the Date (such as only year and month but no day in the month).

Insufficient information. The calendar will use default information to specify the missing fields. This may vary by calendar; for the Gregorian calendar, the default for a field is the same as that of the start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc. Note: The ambiguity in interpretation of what day midnight belongs to, is resolved as so: midnight "belongs" to the following day.
23:59 on Dec 31, 1969 < 00:00 on Jan 1, 1970.
12:00 PM is midday, and 12:00 AM is midnight.
11:59 PM on Jan 1 < 12:00 AM on Jan 2 < 12:01 AM on Jan 2.
11:59 AM on Mar 10 < 12:00 PM on Mar 10 < 12:01 PM on Mar 10.
24:00 or greater are invalid. Hours greater than 12 are invalid in AM/PM mode. Setting the time will never change the date.

If equivalent times are entered in AM/PM or 24 hour mode, equality will be determined by the actual time rather than the entered time.

This class has been subset for J2ME based on the JDK 1.3 Calendar class. Many methods and variables have been pruned, and other methods simplified, in an effort to reduce the size of this class.
See Also:   java.util.Date
See Also:   java.util.TimeZone
version:
   CLDC 1.1 02/01/2002 (based on JDK 1.3)



Field Summary
final public static  intAM
     Value of the AM_PM field indicating the period of the day from midnight to just before noon.
final public static  intAM_PM
     Field number for get and set indicating whether the HOUR is before or after noon.
final public static  intAPRIL
     Value of the MONTH field indicating the fourth month of the year.
final public static  intAUGUST
     Value of the MONTH field indicating the eighth month of the year.
final public static  intDATE
     Field number for get and set indicating the day of the month.
final public static  intDAY_OF_MONTH
     Field number for get and set indicating the day of the month.
final public static  intDAY_OF_WEEK
     Field number for get and set indicating the day of the week.
final public static  intDECEMBER
     Value of the MONTH field indicating the twelfth month of the year.
final public static  intFEBRUARY
     Value of the MONTH field indicating the second month of the year.
final public static  intFRIDAY
     Value of the DAY_OF_WEEK field indicating Friday.
final public static  intHOUR
     Field number for get and set indicating the hour of the morning or afternoon.
final public static  intHOUR_OF_DAY
     Field number for get and set indicating the hour of the day.
final public static  intJANUARY
     Value of the MONTH field indicating the first month of the year.
final public static  intJULY
     Value of the MONTH field indicating the seventh month of the year.
final public static  intJUNE
     Value of the MONTH field indicating the sixth month of the year.
final public static  intMARCH
     Value of the MONTH field indicating the third month of the year.
final public static  intMAY
     Value of the MONTH field indicating the fifth month of the year.
final public static  intMILLISECOND
     Field number for get and set indicating the millisecond within the second.
final public static  intMINUTE
     Field number for get and set indicating the minute within the hour.
final public static  intMONDAY
     Value of the DAY_OF_WEEK field indicating Monday.
final public static  intMONTH
     Field number for get and set indicating the month.
final public static  intNOVEMBER
     Value of the MONTH field indicating the eleventh month of the year.
final public static  intOCTOBER
     Value of the MONTH field indicating the tenth month of the year.
final public static  intPM
     Value of the AM_PM field indicating the period of the day from noon to just before midnight.
final public static  intSATURDAY
     Value of the DAY_OF_WEEK field indicating Saturday.
final public static  intSECOND
     Field number for get and set indicating the second within the minute.
final public static  intSEPTEMBER
     Value of the MONTH field indicating the ninth month of the year.
final public static  intSUNDAY
     Value of the DAY_OF_WEEK field indicating Sunday.
final public static  intTHURSDAY
     Value of the DAY_OF_WEEK field indicating Thursday.
final public static  intTUESDAY
     Value of the DAY_OF_WEEK field indicating Tuesday.
final public static  intWEDNESDAY
     Value of the DAY_OF_WEEK field indicating Wednesday.
final public static  intYEAR
     Field number for get and set indicating the year.
protected  intfields
     The field values for the currently set time for this calendar.
protected  booleanisSet
     The flags which tell if a specified time field for the calendar is set.
protected  longtime
     The currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT.

Constructor Summary
protected  Calendar()
     Constructs a Calendar with the default time zone.

Method Summary
public  booleanafter(Object when)
     Compares the time field records. Equivalent to comparing result of conversion to UTC.
Parameters:
  when - the Calendar to be compared with this Calendar.
public  booleanbefore(Object when)
     Compares the time field records. Equivalent to comparing result of conversion to UTC.
Parameters:
  when - the Calendar to be compared with this Calendar.
abstract protected  voidcomputeFields()
     Converts the current millisecond time value time to field values in fields[].
abstract protected  voidcomputeTime()
     Converts the current field values in fields[] to the millisecond time value time.
public  booleanequals(Object obj)
     Compares this calendar to the specified object. The result is true if and only if the argument is not null and is a Calendar object that represents the same calendar as this object.
Parameters:
  obj - the object to compare with.
final public  intget(int field)
     Gets the value for a given time field.
public static synchronized  CalendargetInstance()
     Gets a calendar using the default time zone.
public static synchronized  CalendargetInstance(TimeZone zone)
     Gets a calendar using the specified time zone.
final public  DategetTime()
     Gets this Calendar's current time.
protected  longgetTimeInMillis()
     Gets this Calendar's current time as a long expressed in milliseconds after January 1, 1970, 0:00:00 GMT (the epoch).
public  TimeZonegetTimeZone()
     Gets the time zone.
final public  voidset(int field, int value)
     Sets the time field with the given value.
final public  voidsetTime(Date date)
     Sets this Calendar's current time with the given Date.
protected  voidsetTimeInMillis(long millis)
     Sets this Calendar's current time from the given long value.
public  voidsetTimeZone(TimeZone value)
     Sets the time zone with the given time zone value.

Field Detail
AM
final public static int AM(Code)
Value of the AM_PM field indicating the period of the day from midnight to just before noon.



AM_PM
final public static int AM_PM(Code)
Field number for get and set indicating whether the HOUR is before or after noon. E.g., at 10:04:15.250 PM the AM_PM is PM.
See Also:   Calendar.AM
See Also:   Calendar.PM
See Also:   Calendar.HOUR



APRIL
final public static int APRIL(Code)
Value of the MONTH field indicating the fourth month of the year.



AUGUST
final public static int AUGUST(Code)
Value of the MONTH field indicating the eighth month of the year.



DATE
final public static int DATE(Code)
Field number for get and set indicating the day of the month. This is a synonym for DAY_OF_MONTH.
See Also:   Calendar.DAY_OF_MONTH



DAY_OF_MONTH
final public static int DAY_OF_MONTH(Code)
Field number for get and set indicating the day of the month. This is a synonym for DATE.
See Also:   Calendar.DATE



DAY_OF_WEEK
final public static int DAY_OF_WEEK(Code)
Field number for get and set indicating the day of the week.



DECEMBER
final public static int DECEMBER(Code)
Value of the MONTH field indicating the twelfth month of the year.



FEBRUARY
final public static int FEBRUARY(Code)
Value of the MONTH field indicating the second month of the year.



FRIDAY
final public static int FRIDAY(Code)
Value of the DAY_OF_WEEK field indicating Friday.



HOUR
final public static int HOUR(Code)
Field number for get and set indicating the hour of the morning or afternoon. HOUR is used for the 12-hour clock. E.g., at 10:04:15.250 PM the HOUR is 10.
See Also:   Calendar.AM_PM
See Also:   Calendar.HOUR_OF_DAY



HOUR_OF_DAY
final public static int HOUR_OF_DAY(Code)
Field number for get and set indicating the hour of the day. HOUR_OF_DAY is used for the 24-hour clock. E.g., at 10:04:15.250 PM the HOUR_OF_DAY is 22.



JANUARY
final public static int JANUARY(Code)
Value of the MONTH field indicating the first month of the year.



JULY
final public static int JULY(Code)
Value of the MONTH field indicating the seventh month of the year.



JUNE
final public static int JUNE(Code)
Value of the MONTH field indicating the sixth month of the year.



MARCH
final public static int MARCH(Code)
Value of the MONTH field indicating the third month of the year.



MAY
final public static int MAY(Code)
Value of the MONTH field indicating the fifth month of the year.



MILLISECOND
final public static int MILLISECOND(Code)
Field number for get and set indicating the millisecond within the second. E.g., at 10:04:15.250 PM the MILLISECOND is 250.



MINUTE
final public static int MINUTE(Code)
Field number for get and set indicating the minute within the hour. E.g., at 10:04:15.250 PM the MINUTE is 4.



MONDAY
final public static int MONDAY(Code)
Value of the DAY_OF_WEEK field indicating Monday.



MONTH
final public static int MONTH(Code)
Field number for get and set indicating the month. This is a calendar-specific value.



NOVEMBER
final public static int NOVEMBER(Code)
Value of the MONTH field indicating the eleventh month of the year.



OCTOBER
final public static int OCTOBER(Code)
Value of the MONTH field indicating the tenth month of the year.



PM
final public static int PM(Code)
Value of the AM_PM field indicating the period of the day from noon to just before midnight.



SATURDAY
final public static int SATURDAY(Code)
Value of the DAY_OF_WEEK field indicating Saturday.



SECOND
final public static int SECOND(Code)
Field number for get and set indicating the second within the minute. E.g., at 10:04:15.250 PM the SECOND is 15.



SEPTEMBER
final public static int SEPTEMBER(Code)
Value of the MONTH field indicating the ninth month of the year.



SUNDAY
final public static int SUNDAY(Code)
Value of the DAY_OF_WEEK field indicating Sunday.



THURSDAY
final public static int THURSDAY(Code)
Value of the DAY_OF_WEEK field indicating Thursday.



TUESDAY
final public static int TUESDAY(Code)
Value of the DAY_OF_WEEK field indicating Tuesday.



WEDNESDAY
final public static int WEDNESDAY(Code)
Value of the DAY_OF_WEEK field indicating Wednesday.



YEAR
final public static int YEAR(Code)
Field number for get and set indicating the year. This is a calendar-specific value.



fields
protected int fields(Code)
The field values for the currently set time for this calendar.



isSet
protected boolean isSet(Code)
The flags which tell if a specified time field for the calendar is set. This is an array of FIELD_COUNT booleans,



time
protected long time(Code)
The currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT.




Constructor Detail
Calendar
protected Calendar()(Code)
Constructs a Calendar with the default time zone.
See Also:   TimeZone.getDefault




Method Detail
after
public boolean after(Object when)(Code)
Compares the time field records. Equivalent to comparing result of conversion to UTC.
Parameters:
  when - the Calendar to be compared with this Calendar. true if the current time of this Calendar is afterthe time of Calendar when; false otherwise.



before
public boolean before(Object when)(Code)
Compares the time field records. Equivalent to comparing result of conversion to UTC.
Parameters:
  when - the Calendar to be compared with this Calendar. true if the current time of this Calendar is beforethe time of Calendar when; false otherwise.



computeFields
abstract protected void computeFields()(Code)
Converts the current millisecond time value time to field values in fields[]. This allows you to sync up the time field values with a new time that is set for the calendar.



computeTime
abstract protected void computeTime()(Code)
Converts the current field values in fields[] to the millisecond time value time.



equals
public boolean equals(Object obj)(Code)
Compares this calendar to the specified object. The result is true if and only if the argument is not null and is a Calendar object that represents the same calendar as this object.
Parameters:
  obj - the object to compare with. true if the objects are the same;false otherwise.



get
final public int get(int field)(Code)
Gets the value for a given time field.
Parameters:
  field - the given time field (either YEAR, MONTH, DATE, DAY_OF_WEEK,HOUR_OF_DAY, HOUR, AM_PM, MINUTE,SECOND, or MILLISECOND the value for the given time field.
exception:
  ArrayIndexOutOfBoundsException - if the parameter is notone of the above.



getInstance
public static synchronized Calendar getInstance()(Code)
Gets a calendar using the default time zone. a Calendar.



getInstance
public static synchronized Calendar getInstance(TimeZone zone)(Code)
Gets a calendar using the specified time zone.
Parameters:
  zone - the time zone to use a Calendar.



getTime
final public Date getTime()(Code)
Gets this Calendar's current time. the current time.
See Also:   Calendar.setTime



getTimeInMillis
protected long getTimeInMillis()(Code)
Gets this Calendar's current time as a long expressed in milliseconds after January 1, 1970, 0:00:00 GMT (the epoch). the current time as UTC milliseconds from the epoch.
See Also:   Calendar.setTimeInMillis



getTimeZone
public TimeZone getTimeZone()(Code)
Gets the time zone. the time zone object associated with this calendar.
See Also:   Calendar.setTimeZone



set
final public void set(int field, int value)(Code)
Sets the time field with the given value.
Parameters:
  field - the given time field.
Parameters:
  value - the value to be set for the given time field.
exception:
  ArrayIndexOutOfBoundsException - if an illegal fieldparameter is received.



setTime
final public void setTime(Date date)(Code)
Sets this Calendar's current time with the given Date.

Note: Calling setTime() with Date(Long.MAX_VALUE) or Date(Long.MIN_VALUE) may yield incorrect field values from get().
Parameters:
  date - the given Date.
See Also:   Calendar.getTime




setTimeInMillis
protected void setTimeInMillis(long millis)(Code)
Sets this Calendar's current time from the given long value.
Parameters:
  millis - the new time in UTC milliseconds from the epoch.
See Also:   Calendar.getTimeInMillis



setTimeZone
public void setTimeZone(TimeZone value)(Code)
Sets the time zone with the given time zone value.
Parameters:
  value - the given time zone.
See Also:   Calendar.getTimeZone



Methods inherited from java.lang.Object
public boolean equals(Object obj)(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.