public class Date
extends java.lang.Object
Constructor and Description |
---|
Date(int month,
int day,
int year)
Creates a date object
|
Modifier and Type | Method and Description |
---|---|
void |
add(int days)
Adds a specified number of days to this Date
|
boolean |
equals(java.lang.Object otherDate)
Is a specified Date equal to this Date?
|
int |
getDay()
Returns the day portion of this Date, as an int between 1 and the
number of days in the month
|
java.lang.String |
getDayOfWeek()
Returns the day of the week (e.g.
|
java.lang.String |
getLongDate()
Returns this Date in long format, with day-of-week,
month name, and the ordinal of the day
|
java.lang.String |
getMediumDate()
Returns this Date in medium format - with month name
|
int |
getMonth()
Returns the month of this Date, as an int between 1 and 12
|
java.lang.String |
getShortDate()
Returns this Date in short format - numbers only
|
int |
getYear()
Returns the year of this Date
|
void |
next()
Increases this Date by one day.
|
void |
previous()
Decreases this Date by one day.
|
void |
subtract(int days)
Subtracts a specified number of days from this Date
|
public Date(int month, int day, int year)
month
- the monthday
- the dayyear
- the yearSpeedDating.DateException
- on attempt to create invalid datepublic int getDay()
public int getMonth()
public int getYear()
public java.lang.String getDayOfWeek()
public boolean equals(java.lang.Object otherDate)
equals
in class java.lang.Object
otherDate
- the Date being tested for equality to this Datepublic 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()