com.partnersoft.data
Class Date

java.lang.Object
  extended by com.partnersoft.data.Date
All Implemented Interfaces:
Immutable, java.lang.Comparable

public class Date
extends java.lang.Object
implements java.lang.Comparable, Immutable

A representation of a date as day, month, and year.

This class is designed as a simpler alternative to Date, which has a number of problems, not the least of which is the fact that Date is really a representation of a date and time.

Copyright 1997-2006 Partner Software, Inc.

Author:
Paul Reavis
See Also:
DateAndTime, Time

Field Summary
static java.text.DateFormat format
           
 
Constructor Summary
Date()
          Creates a Date object representing the current Date.
Date(java.util.Date date)
          Creates a Date object from the given java.util.Date representation.
Date(java.sql.Date sqlDate)
           
Date(long millis)
          Creates a Date object for the given milliseconds.
Date(java.lang.String dateString)
          Creates a Date object from the given String representation.
 
Method Summary
 int compareTo(java.lang.Object nother)
           
 boolean equals(java.lang.Object nother)
           
 java.sql.Date toJavaSqlDate()
           
 java.sql.Timestamp toJavaSqlTimestamp()
           
 java.util.Date toJavaUtilDate()
          Returns this date represented as a Date object.
 java.lang.String toString()
          Returns a String in the standard format representing the Date.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

format

public static final java.text.DateFormat format
Constructor Detail

Date

public Date()
Creates a Date object representing the current Date.


Date

public Date(long millis)
Creates a Date object for the given milliseconds.


Date

public Date(java.lang.String dateString)
Creates a Date object from the given String representation. Uses the format to parse it.

Parameters:
dateString -
Throws:
java.lang.IllegalArgumentException - if it's a bad String.

Date

public Date(java.util.Date date)
Creates a Date object from the given java.util.Date representation.

Parameters:
date -

Date

public Date(java.sql.Date sqlDate)
Method Detail

toJavaUtilDate

public java.util.Date toJavaUtilDate()
Returns this date represented as a Date object.


toJavaSqlTimestamp

public java.sql.Timestamp toJavaSqlTimestamp()

toJavaSqlDate

public java.sql.Date toJavaSqlDate()

equals

public boolean equals(java.lang.Object nother)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object nother)
Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Returns a String in the standard format representing the Date.

Overrides:
toString in class java.lang.Object