Class java.util.Date
All Packages    This Package    Previous    Next

Class java.util.Date

java.lang.Object
   |
   +----java.util.Date

public class Date
extends Object
A wrapper for a date. This class lets you manipulate dates in a system independent way. To print today's date use:
	Date d = new Date();
	System.out.println("today = " + d);
To find out what day I was born:
	Date d = new Date(1963, 0, 16);
	System.out.println("Day of the week: " + d.day());
Version:
1.9, 31 Jan 1995
Author:
Arthur van Hoff

Date()
Creates today's date/time.
Date(int, int, int)
Creates a date.
Date(int, int, int, int, int)
Creates a date.
Date(int, int, int, int, int, int)

after(Date)
Checks whether this date comes after another date.
before(Date)
Checks whether this date comes before another date.
equals(Object)
Compares this object against some other object.
getDate()
Return the day of the month.
getDay()
Returns the day of the week.
getHours()
Returns the hour.
getMinutes()
Returns the minute.
getMonth()
Returns the month.
getSeconds()
Returns the second.
getYear()
Returns the year.
hashCode()
Computes a hashCode.
toString()
Converts a date to a string, using the host's conventions.

Date
  public Date()
Creates today's date/time.

Date

  public Date(int year,
              int month,
              int date)
Creates a date. The fields are normalized before the Date object is created. The arguments do not have to be in the correct range. For example, the 32nd of January is correctly interpreted as the 1st of February. You can use this to figure out what day a particular date falls on.
Parameters:
year - a year after 1900
month - a month between 0-11
date - day of the month between 1-31

Date

  public Date(int year,
              int month,
              int date,
              int hrs,
              int min)
Creates a date. The fields are normalized before the Date object is created. The arguments do not have to be in the correct range. For example, the 32nd of January is correctly interpreted as the 1st of February. You can use this to figure out what day a particular date falls on.
Parameters:
year - a year after 1900
month - a month between 0-11
date - day of the month between 1-31
hrs - hours between 0-23
min - hours between 0-59

Date

  public Date(int year,
              int month,
              int date,
              int hrs,
              int min,
              int sec)

getYear
  public int getYear()
Returns the year. ie: 1995...

getMonth

  public int getMonth()
Returns the month. ie: 0-11

getDate

  public int getDate()
Return the day of the month. ie: 1-31

getDay

  public int getDay()
Returns the day of the week. ie: 0-6

getHours

  public int getHours()
Returns the hour. ie: 0-23

getMinutes

  public int getMinutes()
Returns the minute. ie: 0-59

getSeconds

  public int getSeconds()
Returns the second. ie: 0-59

before

  public boolean before(Date when)
Checks whether this date comes before another date.

after

  public boolean after(Date when)
Checks whether this date comes after another date.

equals

  public boolean equals(Object obj)
Compares this object against some other object.
Parameters:
obj - the object to compare with
Returns:
true if the object is the same
Overrides:
equals in class Object

hashCode

  public int hashCode()
Computes a hashCode.
Overrides:
hashCode in class Object

toString

  public String toString()
Converts a date to a string, using the host's conventions.
Overrides:
toString in class Object


All Packages    This Package    Previous    Next