|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDate.Date
public class Date
A class to implement dates on the Gregorian calendar, i.e. any date since October 15, 1582. Date objects have a month, day, and year
Constructor Summary | |
---|---|
Date(int month,
int day,
int year)
Creates a date object |
Method Summary | |
---|---|
void |
add(int days)
Adds a specified number of days to a Date |
boolean |
equals(java.lang.Object otherDate)
Are two Date objects equal? I.e. |
int |
getDay()
Returns the day portion of a Date, as an int |
java.lang.String |
getDayOfWeek()
Returns the day of the week (e.g. |
java.lang.String |
getLongDate()
Returns the Date in long format, with day-of-week, month name, and the ordinal of the day |
java.lang.String |
getMediumDate()
Returns the Date in medium format - with month name |
int |
getMonth()
Returns the month as an int between 1 and 12 |
java.lang.String |
getMonthName()
Returns the month as a String (e.g. |
java.lang.String |
getShortDate()
Returns the Date in short format - numbers only |
int |
getYear()
Returns the year as a 4-digit int |
void |
next()
Increases a Date by one day. |
void |
previous()
Decreases a Date by one day. |
void |
subtract(int days)
Subtracts a specified number of days from a Date |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Date(int month, int day, int year)
month
- the monthday
- the dayyear
- the year
Date.DateException
- on attempt to create invalid dateMethod Detail |
---|
public int getDay()
public int getMonth()
public int getYear()
public java.lang.String getMonthName()
public java.lang.String getDayOfWeek()
public boolean equals(java.lang.Object otherDate)
equals
in class java.lang.Object
public void next()
public void previous()
public void add(int days)
days
- the number of days by which to increase the Date
(if negative, Date is decreased by that number)public void subtract(int days)
days
- the number of days by which to decrease the Date
(if negative, Date is increased by that number)public java.lang.String getShortDate()
public java.lang.String getMediumDate()
public java.lang.String getLongDate()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |