|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpivot.util.CalendarDate
public class CalendarDate
CalendarDate allows a specific day to be identified within the gregorian calendar system. This identification has no association with any particular time zone and no notion of the time of day.
Constructor Summary | |
---|---|
CalendarDate()
Creates a new CalendarDate representing the current day in the default timezone and the default locale. |
|
CalendarDate(GregorianCalendar calendar)
Creates a new CalendarDate representing the day contained in the specified gregorian calendar (assuming the default locale and the default timezone). |
|
CalendarDate(int year,
int month,
int day)
Creates a new CalendarDate representing the specified year, month, and day of month. |
|
CalendarDate(String date)
Creates a new date representing the specified date string. |
Method Summary | |
---|---|
CalendarDate |
add(int days)
Adds the specified number of days to this calendar date and returns the resulting calendar date. |
int |
compareTo(CalendarDate calendarDate)
Compares this calendar date with another calendar date. |
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one. |
int |
getDay()
Gets the day of the month, 0-based. |
int |
getMonth()
Gets the month field, 0-based. |
int |
getYear()
Gets the year field. |
int |
hashCode()
Returns a hash code value for the object. |
void |
set(int year,
int month,
int day)
Sets the date. |
void |
setDay(int day)
Sets the day field. |
void |
setMonth(int month)
Sets the month field. |
void |
setYear(int year)
Sets the year field. |
int |
subtract(CalendarDate calendarDate)
Gets the number of days in between this calendar date and the specified calendar date. |
GregorianCalendar |
toCalendar()
Translates this calendar date to an instance of GregorianCalendar, with the year, month, and dayOfMonth fields set in the default time zone with the default locale. |
String |
toString()
Returns a string representation of this calendar date in the ISO 8601 "calendar date" format, which is [YYYY]-[MM]-[DD]. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CalendarDate()
public CalendarDate(GregorianCalendar calendar)
calendar
- The calendar containing the year, month, and day fields.public CalendarDate(int year, int month, int day)
year
- The year field. (e.g. 2008)month
- The month field, 0-based. (e.g. 2 for March)day
- The day of the month, 0-based. (e.g. 14 for the 15th)public CalendarDate(String date)
date
- A string in the form of [YYYY]-[MM]-[DD]. (e.g. 2008-07-23)Method Detail |
---|
public void set(int year, int month, int day)
year
- month
- day
- public int getYear()
public void setYear(int year)
year
- public int getMonth()
public void setMonth(int month)
month
- public int getDay()
public void setDay(int day)
day
- public int compareTo(CalendarDate calendarDate)
compareTo
in interface Comparable<CalendarDate>
calendarDate
- The calendar date against which to compare
public CalendarDate add(int days)
More formally, it is defined that given calendar dates c1 and c2, the following will return true:
c1.add(c2.subtract(c1)).equals(c2);
days
- The number of days to add to (or subtract from if negative) this
calendar date
public int subtract(CalendarDate calendarDate)
More formally, it is defined that given calendar dates c1 and c2, the following will return true:
c1.add(c2.subtract(c1)).equals(c2);
calendarDate
- The calendar date to subtract from this calendar date
public GregorianCalendar toCalendar()
public boolean equals(Object o)
equals
in class Object
o
- Reference to the object against which to comparepublic int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |