Ja.NET Standard Edition 5.0

Documentation API Specification

Contents

Date Class Reference

Inherits java::io::Serializable.

Inherited by Date, Time, and Timestamp.

List of all members.


Detailed Description

Date represents a specific moment in time, to the millisecond.

See also:
System.currentTimeMillis

Calendar

GregorianCalendar

SimpleTimeZone

TimeZone


Public Member Functions

 Date ()
 Initializes this Date instance to the current date and time.
 Date (int year, int month, int day)
 Constructs a new Date initialized to midnight in the default TimeZone on the specified date.
 Date (int year, int month, int day, int hour, int minute)
 Constructs a new Date initialized to the specified date and time in the default TimeZone.
 Date (int year, int month, int day, int hour, int minute, int second)
 Constructs a new Date initialized to the specified date and time in the default TimeZone.
 Date (long milliseconds)
 Initializes this Date instance using the specified millisecond value.
 Date (String string)
 Constructs a new Date initialized to the date and time parsed from the specified String.
boolean after (Date date)
 Answers if this Date is after the specified Date.
boolean before (Date date)
 Boolean indication of whether or not this Date occurs earlier than the Date argument.
Object clone ()
 Answers a new Date with the same millisecond value as this Date.
int compareTo (Date date)
 Compare the receiver to the specified Date to determine the relative ordering.
boolean equals (Object object)
 Compares the specified object to this Date and answer if they are equal.
int getDate ()
 Answers the gregorian calendar day of the month for this Date object.
int getDay ()
 Answers the gregorian calendar day of the week for this Date object.
int getHours ()
 Answers the gregorian calendar hour of the day for this Date object.
int getMinutes ()
 Answers the gregorian calendar minute of the hour for this Date object.
int getMonth ()
 Answers the gregorian calendar month for this Date object.
int getSeconds ()
 Answers the gregorian calendar second of the minute for this Date object.
long getTime ()
 Answers this Date as a millisecond value.
int getTimezoneOffset ()
 Answers the timezone offset in minutes of the default TimeZone.
int getYear ()
 Answers the gregorian calendar year since 1900 for this Date object.
int hashCode ()
 Answers an integer hash code for the receiver.
void setDate (int day)
 Sets the gregorian calendar day of the month for this Date object.
void setHours (int hour)
 Sets the gregorian calendar hour of the day for this Date object.
void setMinutes (int minute)
 Sets the gregorian calendar minute of the hour for this Date object.
void setMonth (int month)
 Sets the gregorian calendar month for this Date object.
void setSeconds (int second)
 Sets the gregorian calendar second of the minute for this Date object.
void setTime (long milliseconds)
 Sets this Date to the specified millisecond value.
void setYear (int year)
 Sets the gregorian calendar year since 1900 for this Date object.
String toGMTString ()
 Answers the string representation of this Date in GMT in the format: 22 Jun 1999 13:02:00 GMT.
String toLocaleString ()
 Answers the string representation of this Date for the current Locale.
String toString ()
 Answers the string representation of this Date in the format: Tue Jun 22 13:07:00 GMT 1999.

Static Public Member Functions

static long parse (String string)
 Answers the millisecond value of the date and time parsed from the specified String.
static long UTC (int year, int month, int day, int hour, int minute, int second)
 Answers the millisecond value of the specified date and time in GMT.

Private Member Functions

void writeObject (ObjectOutputStream stream) throws IOException
void readObject (ObjectInputStream stream) throws IOException, ClassNotFoundException

Static Private Member Functions

static int parse (String string, String[] array)
static DateTime parseInternal (String string)
static int zone (String text)

Private Attributes

transient DateTime datetime

Static Private Attributes

static final long serialVersionUID = 7523967970034938905L
static int creationYear = new Date().getYear()

Constructor & Destructor Documentation

Date (  ) 

Initializes this Date instance to the current date and time.

Date ( int  year,
int  month,
int  day 
)

Constructs a new Date initialized to midnight in the default TimeZone on the specified date.

Parameters:
year the year, 0 is 1900
month the month, 0 - 11
day the day of the month, 1 - 31

Reimplemented in Date.

Date ( int  year,
int  month,
int  day,
int  hour,
int  minute 
)

Constructs a new Date initialized to the specified date and time in the default TimeZone.

Parameters:
year the year, 0 is 1900
month the month, 0 - 11
day the day of the month, 1 - 31
hour the hour of day, 0 - 23
minute the minute of the hour, 0 - 59

Date ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second 
)

Constructs a new Date initialized to the specified date and time in the default TimeZone.

Parameters:
year the year, 0 is 1900
month the month, 0 - 11
day the day of the month, 1 - 31
hour the hour of day, 0 - 23
minute the minute of the hour, 0 - 59
second the second of the minute, 0 - 59

Date ( long  milliseconds  ) 

Initializes this Date instance using the specified millisecond value.

The value is the number of milliseconds since Jan. 1, 1970 GMT.

Parameters:
milliseconds the number of milliseconds since Jan. 1, 1970 GMT

Reimplemented in Date.

Date ( String  string  ) 

Constructs a new Date initialized to the date and time parsed from the specified String.

Parameters:
string the String to parse


Member Function Documentation

boolean after ( Date  date  ) 

Answers if this Date is after the specified Date.

Parameters:
date a Date instance to compare
Returns:
true if this Date is after the specified Date, false otherwise

boolean before ( Date  date  ) 

Boolean indication of whether or not this Date occurs earlier than the Date argument.

Parameters:
date a Date instance to compare
Returns:
true if this Date occurs earlier than date, otherwise false

Object clone (  ) 

Answers a new Date with the same millisecond value as this Date.

Returns:
a shallow copy of this Date
See also:
java.lang.Cloneable

int compareTo ( Date  date  ) 

Compare the receiver to the specified Date to determine the relative ordering.

Parameters:
date a Date
Returns:
an int < 0 if this Date is less than the specified Date, 0 if they are equal, and > 0 if this Date is greater

Reimplemented in Timestamp.

boolean equals ( Object  object  ) 

Compares the specified object to this Date and answer if they are equal.

The object must be an instance of Date and have the same millisecond value.

Parameters:
object the object to compare with this object
Returns:
true if the specified object is equal to this Date, false otherwise
See also:
hashCode

Reimplemented in Timestamp.

int getDate (  ) 

Answers the gregorian calendar day of the month for this Date object.

Returns:
the day of the month

Reimplemented in Time.

int getDay (  ) 

Answers the gregorian calendar day of the week for this Date object.

Returns:
the day of the week

Reimplemented in Time.

int getHours (  ) 

Answers the gregorian calendar hour of the day for this Date object.

Returns:
the hour of the day

Reimplemented in Date.

int getMinutes (  ) 

Answers the gregorian calendar minute of the hour for this Date object.

Returns:
the minutes

Reimplemented in Date.

int getMonth (  ) 

Answers the gregorian calendar month for this Date object.

Returns:
the month

Reimplemented in Time.

int getSeconds (  ) 

Answers the gregorian calendar second of the minute for this Date object.

Returns:
the seconds

Reimplemented in Date.

long getTime (  ) 

Answers this Date as a millisecond value.

The value is the number of milliseconds since Jan. 1, 1970 GMT.

Returns:
the number of milliseconds since Jan. 1, 1970 GMT.

Reimplemented in Timestamp.

int getTimezoneOffset (  ) 

Answers the timezone offset in minutes of the default TimeZone.

Returns:
the timezone offset in minutes of the default TimeZone

int getYear (  ) 

Answers the gregorian calendar year since 1900 for this Date object.

Returns:
the year - 1900

Reimplemented in Time.

int hashCode (  ) 

Answers an integer hash code for the receiver.

Objects which are equal answer the same value for this method.

Returns:
the receiver's hash
See also:
equals

static int parse ( String  string,
String[]  array 
) [static, private]

static DateTime parseInternal ( String  string  )  [static, private]

static long parse ( String  string  )  [static]

Answers the millisecond value of the date and time parsed from the specified String.

Many date/time formats are recognized, including IETF standard syntax, i.e. Tue, 22 Jun 1999 12:16:00 GMT-0500

Parameters:
string the String to parse
Returns:
the millisecond value parsed from the String

void setDate ( int  day  ) 

Sets the gregorian calendar day of the month for this Date object.

Parameters:
day the day of the month

Reimplemented in Time.

void setHours ( int  hour  ) 

Sets the gregorian calendar hour of the day for this Date object.

Parameters:
hour the hour of the day

Reimplemented in Date.

void setMinutes ( int  minute  ) 

Sets the gregorian calendar minute of the hour for this Date object.

Parameters:
minute the minutes

Reimplemented in Date.

void setMonth ( int  month  ) 

Sets the gregorian calendar month for this Date object.

Parameters:
month the month

Reimplemented in Time.

void setSeconds ( int  second  ) 

Sets the gregorian calendar second of the minute for this Date object.

Parameters:
second the seconds

Reimplemented in Date.

void setTime ( long  milliseconds  ) 

Sets this Date to the specified millisecond value.

The value is the number of milliseconds since Jan. 1, 1970 GMT.

Parameters:
milliseconds the number of milliseconds since Jan. 1, 1970 GMT.

Reimplemented in Date, Time, and Timestamp.

void setYear ( int  year  ) 

Sets the gregorian calendar year since 1900 for this Date object.

Parameters:
year the year since 1900

Reimplemented in Time.

String toGMTString (  ) 

Answers the string representation of this Date in GMT in the format: 22 Jun 1999 13:02:00 GMT.

Returns:
the string representation of this Date in GMT

String toLocaleString (  ) 

Answers the string representation of this Date for the current Locale.

Returns:
the string representation of this Date for the current Locale

String toString (  ) 

Answers the string representation of this Date in the format: Tue Jun 22 13:07:00 GMT 1999.

Returns:
the string representation of this Date

Reimplemented in Date, Time, and Timestamp.

static long UTC ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second 
) [static]

Answers the millisecond value of the specified date and time in GMT.

Parameters:
year the year, 0 is 1900
month the month, 0 - 11
day the day of the month, 1 - 31
hour the hour of day, 0 - 23
minute the minute of the hour, 0 - 59
second the second of the minute, 0 - 59
Returns:
long

static int zone ( String  text  )  [static, private]

void writeObject ( ObjectOutputStream  stream  )  throws IOException [private]

void readObject ( ObjectInputStream  stream  )  throws IOException, ClassNotFoundException [private]


Member Data Documentation

final long serialVersionUID = 7523967970034938905L [static, private]

Reimplemented in Date, Time, and Timestamp.

int creationYear = new Date().getYear() [static, private]

transient DateTime datetime [private]