All Packages Class Hierarchy This Package Previous Next Index
Class corejava.Day
java.lang.Object
|
+----corejava.Day
- public class Day
- extends Object
- implements Cloneable, Serializable
-
Day()
- Constructs today's date
-
Day(int, int, int)
- Constructs a specific date
-
advance(int)
- Advances this day by n days.
-
clone()
- Makes a bitwise copy of a Day object
-
daysBetween(Day)
- The number of days between this and day parameter
-
getDay()
-
-
getMonth()
-
-
getYear()
-
-
toString()
- A string representation of the day
-
weekday()
- Gets the weekday
Day
public Day()
- Constructs today's date
Day
public Day(int yyyy,
int m,
int d)
- Constructs a specific date
- Parameters:
- yyyy - year (full year, e.g., 1996,
not starting from 1900)
- m - month
- d - day
- Throws: IllegalArgumentException
- if yyyy m d not a
valid date
advance
public void advance(int n)
- Advances this day by n days. For example.
d.advance(30) adds thirdy days to d
- Parameters:
- n - the number of days by which to change this
day (can be < 0)
getDay
public int getDay()
getMonth
public int getMonth()
getYear
public int getYear()
weekday
public int weekday()
- Gets the weekday
- Returns:
- the weekday (0 = Sunday, 1 = Monday, ...,
6 = Saturday)
daysBetween
public int daysBetween(Day b)
- The number of days between this and day parameter
- Parameters:
- b - any date
- Returns:
- the number of days between this and day parameter
and b (> 0 if this day comes after b)
toString
public String toString()
- A string representation of the day
- Returns:
- a string representation of the day
- Overrides:
- toString in class Object
clone
public Object clone()
- Makes a bitwise copy of a Day object
- Returns:
- a bitwise copy of a Day object
- Overrides:
- clone in class Object
All Packages Class Hierarchy This Package Previous Next Index