is used to represent the date and time. The year,
month, day, hour, minute, second, and milliseconds can
all be set or obtained from a Calendar object. The default
Calendar object has the current time in it. There are also
methods for making data calculations.
Other related classes: Date, and DateFormat, ...
The default Calendar constructor produces an object whose fields are set to the current time for the default timezone and locale.
Calendar now = Calendar.getInstance();
The following field names can be used
as an argument to the
Calendar.get(. . .)
method. In all of these examples,
is a Calendar object.
||int value of the year|
||int value of the month (0-11)|
||int value of the day of the month (1-31)|
||int value of the day of the week (0-6)|
||int value of the hour in 12 hour notation (0-12)|
||returns either Calendar.AM or Calendar.PM|
||int value of the hour of the day in 24-hour notation (0-24)|
||int value of the minute in the hour (0-59)|
||int value of the second within the minute (0-59).|
||int value of the milliseconds within a second (0-999).|
Sun has never gotten the Date class right, even 10 years after the first release. Take a look at weblogs.java.net/blog/mister__m/archive/2006/02/tiger_and_dates.html.