javatools.util
Class FormattedDate

java.lang.Object
  |
  +--javatools.util.FormattedDate

public class FormattedDate
extends java.lang.Object

It's a java.util.Date, except in the fact it returns its "toString" value in a formatted way.


Constructor Summary
FormattedDate()
          Creates new FormattedDateTemp
FormattedDate(java.util.Date ddate)
          Creates a new FormattedDate.
FormattedDate(long ldate)
          Creates a new FormattedDate.
 
Method Summary
 boolean after(java.util.Date date)
          Checks if a given date is after this date.
 boolean before(java.util.Date date)
          Checks if a given date is after this date.
 java.lang.Object clone()
          Clones this object.
 int compareTo(java.util.Date date)
          Compares this date to a given date.
 int compareTo(java.lang.Object obj)
          Compares this object to another.
 boolean equals(java.lang.Object obj)
          Checks if an object equals this date.
 java.util.Date getDate()
          Returns a normal Date representing the same date.
 java.text.SimpleDateFormat getFormatter()
          Returns the current formatter to use.
 long getTime()
          Returns the time of this date in millis.
 int hashCode()
          Returns a hash code for this object.
 void setFormatter(java.text.SimpleDateFormat pFormatter)
          Sets the formatter.
 void setTime(long param)
          Sets the time in millis.
 java.lang.String toString()
          Returns the date in a formatted way.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FormattedDate

public FormattedDate()
Creates new FormattedDateTemp


FormattedDate

public FormattedDate(long ldate)
Creates a new FormattedDate.

Parameters:
ldate - The value in millis of the date.

FormattedDate

public FormattedDate(java.util.Date ddate)
Creates a new FormattedDate.

Parameters:
ddate - The base date to refer to.
Method Detail

getDate

public java.util.Date getDate()
Returns a normal Date representing the same date.

Returns:
The Date.

after

public boolean after(java.util.Date date)
Checks if a given date is after this date.

Parameters:
date - The date to check.
Returns:
true: the passed date is after this date; false: otherwise.

before

public boolean before(java.util.Date date)
Checks if a given date is after this date.

Parameters:
date - The date to check.
Returns:
true: the passed date is after this date; false: otherwise.

clone

public java.lang.Object clone()
Clones this object.

Overrides:
clone in class java.lang.Object
Returns:
The cloned object.

compareTo

public int compareTo(java.lang.Object obj)
Compares this object to another.

Parameters:
obj - The object to check.
Returns:
Zero if they are equal; positive if obj is after this Date; negative if obj is before this Date.

compareTo

public int compareTo(java.util.Date date)
Compares this date to a given date.

Parameters:
date - The date to check.
Returns:
Zero if they are equal; positive if date is after this Date; negative if date is before this Date.

equals

public boolean equals(java.lang.Object obj)
Checks if an object equals this date.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object to check.
Returns:
true: the objects are equal; false: the objects are NOT equal;

getTime

public long getTime()
Returns the time of this date in millis.

Returns:
The value in millis for this date.

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this object.

setTime

public void setTime(long param)
Sets the time in millis.

Parameters:
param - The time in millis.

toString

public java.lang.String toString()
Returns the date in a formatted way.

Overrides:
toString in class java.lang.Object
Returns:
A string representing this date in a formatted way.

setFormatter

public void setFormatter(java.text.SimpleDateFormat pFormatter)
Sets the formatter.

Parameters:
pFormatter - The date formatter to use.

getFormatter

public java.text.SimpleDateFormat getFormatter()
Returns the current formatter to use.

Returns:
The currently using formatter.