Name
Timestamp
Synopsis
Extends the java.util.Date
class to function as an SQL TIMESTAMP
value by adding a nanoseconds component. The getTime()
method returns the time in milliseconds since January 1, 1970 00:00:00 GMT to the latest integral second. To include fractional seconds, divide the value returned by getNanos()
by 1000000 and add this to the result returned by getTime()
. This allows accurate comparisons with java.util.Date
objects. The valueOf()
method parses a String
in the format yyyy
-
mm
-
dd
hh
:
mm
:
ss
.
fffffffff
into a Timestamp
.
public class Timestamp extends java.util.Date { // Public Constructors public Timestamp( long time); public Timestamp(int year, int month, int date, int hour, // # int minute, int second, int nano); // Public Class Methods public static Timestamp valueOf( String s); // Public Instance Methods public boolean after( Timestamp ts); public boolean before( Timestamp ts); public int compareTo( Timestamp ts); // 1.4 public boolean equals( Timestamp ts); public int getNanos(); public void setNanos( int n); // Public Methods Overriding Date public int compareTo( Object o); // 1.4 public boolean equals( Object ts); // 1.2 public long getTime(); // 1.4 public void setTime( long time); // 1.4 public String toString(); }
Passed To
CallableStatement.setTimestamp()
, PreparedStatement.setTimestamp()
, java.sql.ResultSet.updateTimestamp()
, SQLOutput.writeTimestamp() ...
Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.