java.sql
public class Timestamp extends Date
java.util.Date
as
the java.sql.Date
and java.sql.Time
classes are.
Constructor Summary | |
---|---|
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.
| |
Timestamp(long date)
This method initializes a new instance of this class with the
specified time value representing the number of milliseconds since
Jan 1, 1970 at 12:00 midnight GMT.
|
Method Summary | |
---|---|
boolean | after(Timestamp ts)
This methods tests whether this object is later than the specified
object.
|
boolean | before(Timestamp ts)
This methods tests whether this object is earlier than the specified
object.
|
int | compareTo(Timestamp ts)
Compares this Timestamp to another one.
|
int | compareTo(Date obj)
Compares this Timestamp to another one. |
boolean | equals(Object obj)
This method these the specified Object for equality
against this object. |
boolean | equals(Timestamp ts)
This method tests the specified timestamp for equality against this
object. |
int | getNanos()
This method returns the nanosecond value for this object. |
long | getTime()
Return the value of this Timestamp as the number of milliseconds
since Jan 1, 1970 at 12:00 midnight GMT. |
void | setNanos(int nanos)
This method sets the nanosecond value for this object.
|
String | toString()
This method returns this date in JDBC format.
|
static Timestamp | valueOf(String str)
This method returns a new instance of this class by parsing a
date in JDBC format into a Java date.
|
Deprecated:
This method initializes a new instance of this class with the specified year, month, and day.Parameters: year The year for this Timestamp (year - 1900) month The month for this Timestamp (0-11) day The day for this Timestamp (1-31) hour The hour for this Timestamp (0-23) minute The minute for this Timestamp (0-59) second The second for this Timestamp (0-59) nanos The nanosecond value for this Timestamp (0 to 999,999,9999)
Parameters: date The time value to intialize this Time
to.
Parameters: ts The other Timestamp
to test against.
Returns: true
if this object is later than the other object,
false
otherwise.
Parameters: ts The other Timestamp
to test against.
Returns: true
if this object is earlier than the other object,
false
otherwise.
Timestamp
to another one.
Parameters: ts The other Timestamp.
Returns: 0
, if both Timestamp
's represent exactly
the same date, a negative value if this Timestamp
is
before the specified Timestamp
and a positive value
otherwise.
Since: 1.2
Timestamp
to another one. This behaves like
compareTo(Timestamp)
, but it may throw a
ClassCastException
, if the specified object is not of type
Timestamp
.
Parameters: obj The object to compare with.
Returns: 0
, if both Timestamp
's represent exactly
the same date, a negative value if this Timestamp
is
before the specified Timestamp
and a positive value
otherwise.
Throws: ClassCastException if obj is not of type Timestamp.
Since: 1.2
See Also: compareTo
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: obj The object to test against for equality.
Returns: true
if the specified object is equal to this
object, false
otherwise.
null
and contains all the same time value fields
as this object.
Parameters: ts The Timestamp
to test against for equality.
Returns: true
if the specified object is equal to this
object, false
otherwise.
Returns: The nanosecond value for this object.
Parameters: nanos The nanosecond value for this object.
Returns: This date as a string.
Parameters: str The string to parse.
Returns: The resulting java.sql.Timestamp
value.