Class Day

java.lang.Object
  extended by Day

public class Day
extends java.lang.Object


Constructor Summary
Day()
          Constructs a day object representing today's date.
Day(int aYear, int aMonth, int aDayOfMonth)
          Constructs a day with a given year, month, and day of the Julian/Gregorian calendar.
 
Method Summary
 void addDays(int numberOfDays)
          Changes to a date that is a certain number of days away from the current date.
 int daysFrom(Day other)
          Returns the number of days between this day and another day.
 int getDayOfMonth()
          Returns the day of the month of this day.
 int getMonth()
          Returns the month of this day.
 int getYear()
          Returns the year of this day.
 java.lang.String toString()
           
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Day

public Day()
Constructs a day object representing today's date.


Day

public Day(int aYear,
           int aMonth,
           int aDayOfMonth)
Constructs a day with a given year, month, and day of the Julian/Gregorian calendar. The Julian calendar is used for all days before October 15, 1582

Parameters:
aYear - a year (any number other than 0)
aMonth - a month between 1 and 12
aDayOfMonth - a day of the month between 1 and 31
Method Detail

addDays

public void addDays(int numberOfDays)
Changes to a date that is a certain number of days away from the current date.

Parameters:
numberOfDays - the number of days, can be negative

daysFrom

public int daysFrom(Day other)
Returns the number of days between this day and another day.

Parameters:
other - the other day
Returns:
the number of days that this day is away from the other (>0 if this day comes later than other)

getDayOfMonth

public int getDayOfMonth()
Returns the day of the month of this day.

Returns:
the day of the month

getMonth

public int getMonth()
Returns the month of this day.

Returns:
the month

getYear

public int getYear()
Returns the year of this day.

Returns:
the year

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object