java.sql
Class Timestamp
java.lang.Object
|
+--java.util.Date
|
+--java.sql.Timestamp
public class
Timestampextends
Date This class is a wrapper around java.util.Date to allow the JDBC
driver to identify the value as a SQL Timestamp. Note that this
class also adds an additional field for nano-seconds, and so
is not completely identical to java.util.Date
as
the java.sql.Date
and java.sql.Time
classes are.
Author:- Aaron M. Renn (arenn@urbanophile.com)
Timestamp(int year, int month, int day, int hour, int minute, int second, int nanos)
|
Timestamp(long date)
|
Timestamp
public Timestamp(int year, int month, int day, int hour, int minute, int second, int nanos)
This method initializes a new instance of this class with the
specified year, month, and day.
Parameters:
Timestamp
public Timestamp(long date)
This method initializes a new instance of this class with the
specified time value representing the number of seconds since
Jan 1, 1970 at 12:00 midnight GMT.
Parameters:
after
public boolean after(java.sql.Timestamp ts)
This methods tests whether this object is later than the specified
object.
Parameters:
Returns:
true
if this object is later than the other object,
false
otherwise.
before
public boolean before(java.sql.Timestamp ts)
This methods tests whether this object is earlier than the specified
object.
Parameters:
Returns:
true
if this object is earlier than the other object,
false
otherwise.
compareTo
public int compareTo(java.lang.Object obj)
Compares this Timestamp to another. This behaves like
compareTo(Timestamp)
, but it may throw a
ClassCastException
Since:Parameters:
Returns:
- 0, if the Timestamp represented
by obj is exactly the same as the time represented by this
object, a negative if this Timestamp is before the other Timestamp, and
a positive value otherwise.
Throws:
compareTo
public int compareTo(java.sql.Timestamp ts)
Compare two Timestamp
Since:Parameters:
Returns:
- 0, if the date represented
by obj is exactly the same as the time represented by this
object, a negative if this Timestamp is before the other Timestamp, and
a positive value otherwise.
equals
public boolean equals(java.lang.Object obj)
This method these the specified Object
for equality
against this object. This will be true if an only if the specified
object is an instance of Timestamp
and has the same
time value fields.
Parameters:
Returns:
true
if the specified object is equal to this
object, false
otherwise.
equals
public boolean equals(java.sql.Timestamp ts)
This method tests the specified timestamp for equality against this
object. This will be true if and only if the specified object is
not null
and contains all the same time value fields
as this object.
Parameters:
Returns:
true
if the specified object is equal to this
object, false
otherwise.
getNanos
public int getNanos()
This method returns the nanosecond value for this object.
Returns:
- The nanosecond value for this object.
setNanos
public void setNanos(int nanos)
This method sets the nanosecond value for this object.
Parameters:
toString
public String toString()
This method returns this date in JDBC format.
Returns:
valueOf
public static Timestamp valueOf(java.lang.String str)
This method returns a new instance of this class by parsing a
date in JDBC format into a Java date.
Parameters:
Returns:
- The resulting
java.sql.Timestamp
value.
java.util.Date
as thejava.sql.Date
andjava.sql.Time
classes are.