Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.sql

Class Timestamp

java.lang.Object
|
+--java.util.Date
   |
   +--java.sql.Timestamp


public class Timestamp

extends Date

This class is a wrapper around java.util.Date to allow the JDBC driver to identify the value as a SQL Timestamp. Note that this class also adds an additional field for nano-seconds, and so is not completely identical to java.util.Date as the java.sql.Date and java.sql.Time classes are.

Author:

Constructor Summary

Timestamp(int year, int month, int day, int hour, int minute, int second, int nanos)

This method initializes a new instance of this class with the specified year, month, and day.
Timestamp(long date)

This method initializes a new instance of this class with the specified time value representing the number of seconds since Jan 1, 1970 at 12:00 midnight GMT.

Method Summary

booleanafter(java.sql.Timestamp ts)

This methods tests whether this object is later than the specified object.
booleanbefore(java.sql.Timestamp ts)

This methods tests whether this object is earlier than the specified object.
intcompareTo(java.sql.Timestamp ts)

Compare two Timestamp
intcompareTo(java.lang.Object obj)

Compares this Timestamp to another.
booleanequals(java.lang.Object obj)

This method these the specified Object for equality against this object.
booleanequals(java.sql.Timestamp ts)

This method tests the specified timestamp for equality against this object.
intgetNanos()

This method returns the nanosecond value for this object.
voidsetNanos(int nanos)

This method sets the nanosecond value for this object.
java.lang.StringtoString()

This method returns this date in JDBC format.
static java.sql.TimestampvalueOf(java.lang.String str)

This method returns a new instance of this class by parsing a date in JDBC format into a Java date.

Constructor Details

Timestamp

public Timestamp(int year, int month, int day, int hour, int minute, int second, int nanos)

This method initializes a new instance of this class with the specified year, month, and day.

Parameters:


Timestamp

public Timestamp(long date)

This method initializes a new instance of this class with the specified time value representing the number of seconds since Jan 1, 1970 at 12:00 midnight GMT.

Parameters:


Method Details

after

public boolean after(java.sql.Timestamp ts)

This methods tests whether this object is later than the specified object.

Parameters:

Returns:


before

public boolean before(java.sql.Timestamp ts)

This methods tests whether this object is earlier than the specified object.

Parameters:

Returns:


compareTo

public int compareTo(java.lang.Object obj)

Compares this Timestamp to another. This behaves like compareTo(Timestamp), but it may throw a ClassCastException

Since:Parameters:

Returns:

Throws:


compareTo

public int compareTo(java.sql.Timestamp ts)

Compare two Timestamp

Since:Parameters:

Returns:


equals

public boolean equals(java.lang.Object obj)

This method these the specified Object for equality against this object. This will be true if an only if the specified object is an instance of Timestamp and has the same time value fields.

Parameters:

Returns:


equals

public boolean equals(java.sql.Timestamp ts)

This method tests the specified timestamp for equality against this object. This will be true if and only if the specified object is not null and contains all the same time value fields as this object.

Parameters:

Returns:


getNanos

public int getNanos()

This method returns the nanosecond value for this object.

Returns:


setNanos

public void setNanos(int nanos)

This method sets the nanosecond value for this object.

Parameters:


toString

public String toString()

This method returns this date in JDBC format.

Returns:


valueOf

public static Timestamp valueOf(java.lang.String str)

This method returns a new instance of this class by parsing a date in JDBC format into a Java date.

Parameters:

Returns: