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

Constructor Index

 o Day()
Constructs today's date
 o Day(int, int, int)
Constructs a specific date

Method Index

 o advance(int)
Advances this day by n days.
 o clone()
Makes a bitwise copy of a Day object
 o daysBetween(Day)
The number of days between this and day parameter
 o getDay()
 o getMonth()
 o getYear()
 o toString()
A string representation of the day
 o weekday()
Gets the weekday

Constructors

 o Day
 public Day()
Constructs today's date

 o 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

Methods

 o 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)
 o getDay
 public int getDay()
 o getMonth
 public int getMonth()
 o getYear
 public int getYear()
 o weekday
 public int weekday()
Gets the weekday

Returns:
the weekday (0 = Sunday, 1 = Monday, ..., 6 = Saturday)
 o 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)
 o toString
 public String toString()
A string representation of the day

Returns:
a string representation of the day
Overrides:
toString in class Object
 o 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