|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Date | +--java.sql.Timestamp
This class is a thin wrapper around java.util.Date that allows JDBC to identify this as a SQL TIMESTAMP value. It adds the ability to hold the SQL TIMESTAMP nanos value and provides formatting and parsing operations to support the JDBC escape syntax for timestamp values.
Note: This type is a composite of a java.util.Date and a separate nanos value. Only integral seconds are stored in the java.util.Date component. The fractional seconds - the nanos - are separate. The getTime method will only return integral seconds. If a time value that includes the fractional seconds is desired you must convert nanos to milliseconds (nanos/1000000) and add this to the getTime value. Also note that the hashcode() method uses the underlying java.util.Data implementation and therefore does not include nanos in its computation.
Constructor Summary | |
Timestamp(int year,
int month,
int date,
int hour,
int minute,
int second,
int nano)
Deprecated. |
|
Timestamp(long time)
Construct a Timestamp using a milliseconds time value. |
Method Summary | |
boolean | after(Timestamp ts)
Is this timestamp later than the timestamp argument? |
boolean | before(Timestamp ts)
Is this timestamp earlier than the timestamp argument? |
boolean | equals(Object ts)
Test Timestamp values for equality. |
boolean | equals(Timestamp ts)
Test Timestamp values for equality |
int | getNanos()
Get the Timestamp's nanos value |
void | setNanos(int n)
Set the Timestamp's nanos value |
String | toString()
Format a timestamp in JDBC timestamp escape format |
static Timestamp | valueOf(String s)
Convert a string in JDBC timestamp escape format to a Timestamp value |
Methods inherited from class java.util.Date | |
after , before , compareTo , compareTo , getDate , getDay , getHours , getMinutes , getMonth , getSeconds , getTime , getTimezoneOffset , getYear , hashCode , parse , setDate , setHours , setMinutes , setMonth , setSeconds , setTime , setYear , toGMTString , toLocaleString , UTC |
Methods inherited from class java.lang.Object | |
clone , finalize , getClass , notify , notifyAll , wait , wait , wait |
Constructor Detail |
public Timestamp(int year, int month, int date, int hour, int minute, int second, int nano)
year
- year-1900
month
- 0 to 11
day
- 1 to 31
hour
- 0 to 23
minute
- 0 to 59
second
- 0 to 59
nano
- 0 to 999,999,999public Timestamp(long time)
time
- milliseconds since January 1, 1970, 00:00:00 GMTMethod Detail |
public static Timestamp valueOf(String s)
s
- timestamp in format "yyyy-mm-dd hh:mm:ss.fffffffff"public String toString()
public int getNanos()
public void setNanos(int n)
n
- the new fractional seconds componentpublic boolean equals(Timestamp ts)
ts
- the Timestamp value to compare withpublic boolean equals(Object ts)
ts
- the Object value to compare withpublic boolean before(Timestamp ts)
ts
- the Timestamp value to compare withpublic boolean after(Timestamp ts)
ts
- the Timestamp value to compare with
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |