Class java.sql.Timestamp
All Packages Class Hierarchy This Package Previous Next Index
Class java.sql.Timestamp
java.lang.Object
|
+----java.util.Date
|
+----java.sql.Timestamp
- public class Timestamp
- extends Date
This class extends the standard sun.util.date class with nanos.
This lets it represent SQL timestamps.
Note: The granularity of sub-second timestamp precision may vary
between database fields, and stored values will get rounded to the field's
internal precision.
-
Timestamp(int, int, int, int, int, int, int)
- Construct a Timestamp
-
equals(Timestamp)
- Test Timestamp values for equality
-
getNanos()
- Get the Timestamp's nanos value
-
setNanos(int)
- Set the Timestamp's nanos value
-
toString()
- Format a Timestamp as yyyy-mm-dd hh:mm:ss.f...
-
valueOf(String)
- Convert a formatted string to a Timestamp value
Timestamp
public Timestamp(int year,
int month,
int date,
int hour,
int minute,
int second,
int nano)
- Construct a Timestamp
- Parameters:
- 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,999
valueOf
public static Timestamp valueOf(String s)
- Convert a formatted string to a Timestamp value
- Parameters:
- s - timestamp in format "yyyy-mm-dd hh:mm:ss.f"
- Returns:
- corresponding Date
toString
public String toString()
- Format a Timestamp as yyyy-mm-dd hh:mm:ss.f...
- Returns:
- a formatted timestamp String
- Overrides:
- toString in class Date
getNanos
public int getNanos()
- Get the Timestamp's nanos value
- Returns:
- the Timestamp's fractional seconds component
setNanos
public void setNanos(int n)
- Set the Timestamp's nanos value
- Parameters:
- n - the new fractional seconds component
equals
public boolean equals(Timestamp ts)
- Test Timestamp values for equality
- Parameters:
- ts - the Timestamp value to compare with
All Packages Class Hierarchy This Package Previous Next Index