| java.lang.Object | ||
| ↳ | java.util.Date | |
| ↳ | java.sql.Timestamp | |
A Java representation of the SQL TIMESTAMP type. It provides the capability to represent 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 cautious in their use of Timestamp objects and should not assume that they are interchangeable with java.util.Date objects when used outside the confines of the java.sql package.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
This constructor is deprecated.
Please use the constructor Timestamp(long) Returns a
Timestamp corresponding to the time specified by the supplied
values for Year, Month, Date, Hour, Minutes, Seconds and
Nanoseconds
| |||||||||||
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 object.
| |||||||||||
Tests to see if this timestamp is equal to a supplied timestamp.
| |||||||||||
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 of the form "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 of the form "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 is deprecated.Please use the constructor Timestamp(long) 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 |
|---|
Returns true if this timestamp object is earlier than the supplied timestamp, otherwise returns false.
| theTimestamp | the timestamp to compare with this timestamp object |
|---|
Compares this Timestamp object with a supplied Timestamp object
| theObject | the timestamp to compare with this timestamp object, passed in as an Object |
|---|
| 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 |
|---|
Tests to see if this timestamp is equal to a supplied object.
| theObject | the object to compare with this object |
|---|
Tests to see if this timestamp is equal to a supplied timestamp.
| theTimestamp | the timestamp to compare with this timestamp object, passed in as an 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
| n | number of nanoseconds |
|---|
| IllegalArgumentException | if number of nanoseconds smaller than 0 or greater than 999999999 |
|---|
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 | the number of milliseconds since Jan. 1, 1970 GMT. |
|---|
Returns the timestamp formatted as a String in the JDBC Timestamp Escape format, which is of the form "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 of the form "yyyy-mm-dd hh:mm:ss.nnnnnnnnn"
| s | the String containing a time in JDBC timestamp escape format |
|---|
| IllegalArgumentException | if the provided String is null |
|---|