java.lang.Object | ||
↳ | java.util.Date | |
↳ | java.sql.Timestamp |
A Java representation of the SQL TIMESTAMP
type. It provides the
capability of representing the SQL TIMESTAMP
nanosecond value, in
addition to the regular date/time value which has millisecond resolution.
The Timestamp
class consists of a regular date/time value, where only
the integral seconds value is stored, plus a nanoseconds value where the
fractional seconds are stored.
The addition of the nanosecond value field to the Timestamp
object
makes it significantly different from the java.util.Date
object which
it extends. Users should be aware that Timestamp
objects are not
interchangable with java.util.Date
objects when used outside the
confines of the java.sql
package.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This constructor was deprecated
in API level 1.
Use the constructor
Timestamp(long) instead. | |||||||||||
Returns a
Timestamp object corresponding to the time represented
by a supplied time value. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns
true if this timestamp object is later than the supplied
timestamp, otherwise returns false . | |||||||||||
Returns
true if this Timestamp object is earlier than the
supplied timestamp, otherwise returns false . | |||||||||||
Compares this
Timestamp object with a supplied Timestamp
object. | |||||||||||
Compares this
Timestamp object with a supplied Timestamp
object. | |||||||||||
Tests to see if this timestamp is equal to a supplied timestamp.
| |||||||||||
Tests to see if this timestamp is equal to a supplied object.
| |||||||||||
Gets this
Timestamp 's nanosecond value | |||||||||||
Returns the time represented by this
Timestamp object, as a long
value containing the number of milliseconds since the Epoch (January 1
1970, 00:00:00.000 GMT). | |||||||||||
Sets the nanosecond value for this
Timestamp . | |||||||||||
Sets the time represented by this
Timestamp object to the
supplied time, defined as the number of milliseconds since the Epoch
(January 1 1970, 00:00:00.000 GMT). | |||||||||||
Returns the timestamp formatted as a String in the JDBC Timestamp Escape
format, which is
"yyyy-MM-dd HH:mm:ss.nnnnnnnnn" . | |||||||||||
Creates a
Timestamp object with a time value equal to the time
specified by a supplied String holding the time in JDBC timestamp escape
format, which is "yyyy-MM-dd HH:mm:ss.nnnnnnnnn " |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.Date
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Comparable
|
This constructor was deprecated
in API level 1.
Use the constructor Timestamp(long)
instead.
Returns a Timestamp
corresponding to the time specified by the
supplied values for Year, Month, Date, Hour,
Minutes, Seconds and Nanoseconds.
theYear | specified as the year minus 1900. |
---|---|
theMonth | specified as an integer in the range [0,11]. |
theDate | specified as an integer in the range [1,31]. |
theHour | specified as an integer in the range [0,23]. |
theMinute | specified as an integer in the range [0,59]. |
theSecond | specified as an integer in the range [0,59]. |
theNano | which defines the nanosecond value of the timestamp specified as an integer in the range [0,999'999'999] |
IllegalArgumentException | if any of the parameters is out of range. |
---|
Returns a Timestamp
object corresponding to the time represented
by a supplied time value.
theTime | a time value in the format of milliseconds since the Epoch (January 1 1970 00:00:00.000 GMT). |
---|
Returns true
if this timestamp object is later than the supplied
timestamp, otherwise returns false
.
theTimestamp | the timestamp to compare with this timestamp object. |
---|
true
if this Timestamp
object is later than the
supplied timestamp, false
otherwise.
Returns true
if this Timestamp
object is earlier than the
supplied timestamp, otherwise returns false
.
theTimestamp | the timestamp to compare with this Timestamp object. |
---|
true
if this Timestamp
object is earlier than the
supplied timestamp, false
otherwise.
Compares this Timestamp
object with a supplied Timestamp
object.
theObject | the timestamp to compare with this Timestamp object,
passed as an Object . |
---|
0
if the two Timestamp
objects are equal in time
< 0
if this Timestamp
object is before
the supplied Timestamp
and a value
> 0
if this Timestamp
object is after the
supplied Timestamp
ClassCastException | if the supplied object is not a Timestamp object.
|
---|
Compares this Timestamp
object with a supplied Timestamp
object.
theTimestamp | the timestamp to compare with this Timestamp object,
passed in as a Timestamp . |
---|
0
, if the two Timestamp
objects are
equal in time< 0
, if this Timestamp
object is before the
supplied Timestamp
> 0
, if this Timestamp
object is after the
supplied Timestamp
Tests to see if this timestamp is equal to a supplied timestamp.
theTimestamp | the timestamp to compare with this Timestamp object,
passed as an Object . |
---|
true
if this Timestamp
object is equal to the
supplied Timestamp
object, false
otherwise.
Tests to see if this timestamp is equal to a supplied object.
theObject | the object to which this timestamp is compared. |
---|
true
if this Timestamp
object is equal to the
supplied Timestamp
objectfalse
if the object
is not a Timestamp
object or if the object is a Timestamp
but represents a different instant in time.
Gets this Timestamp
's nanosecond value
Returns the time represented by this Timestamp
object, as a long
value containing the number of milliseconds since the Epoch (January 1
1970, 00:00:00.000 GMT).
Sets the nanosecond value for this Timestamp
.
n | number of nanoseconds. |
---|
IllegalArgumentException | if number of nanoseconds smaller than 0 or greater than 999,999,999. |
---|
Sets the time represented by this Timestamp
object to the
supplied time, defined as the number of milliseconds since the Epoch
(January 1 1970, 00:00:00.000 GMT).
theTime | number of milliseconds since the Epoch (January 1 1970, 00:00:00.000 GMT). |
---|
Returns the timestamp formatted as a String in the JDBC Timestamp Escape
format, which is "yyyy-MM-dd HH:mm:ss.nnnnnnnnn"
.
Timestamp
, in JDBC Timestamp escape format.
Creates a Timestamp
object with a time value equal to the time
specified by a supplied String holding the time in JDBC timestamp escape
format, which is "yyyy-MM-dd HH:mm:ss.nnnnnnnnn
"
s | the String containing a time in JDBC timestamp escape
format. |
---|
Timestamp
object with time value as defined by the
supplied String
.IllegalArgumentException | if the provided string is null .
|
---|