O'Reilly logo

Database Programming with JDBC & Java, Second Edition by George Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Timestamp

Synopsis

Class Name: java.sql.Timestamp

Superclass: java.util.Date

Immediate Subclasses: None

Interfaces Implemented: None

Availability: JDK 1.1

Description

This class serves as a SQL representation of the Java Date class specifically designed to serve as a SQL TIMESTAMP. It also provides the ability to hold nanoseconds as required by SQL TIMESTAMP values. You should keep in mind that this class uses the java.util.Date version of hashcode( ). This means that two timestamps that differ only by nanoseconds will have identical hashcode() return values.

Class Summary

public class Timestamp extends java.util.Date {
    static public Timestamp valueOf(String s);
    #public Timestamp(int year, int month, int date, 
        int hour, int minute, int second, int nano);
    public Timestamp(long time);
    public boolean after(Timestamp t);
    public boolean before(Timestamp t);
    public boolean equals(Timestamp t);
    public int getNanos( );
    public void setNanos(int n);
    public String toString( );
}

Object Constructors

Timestamp( )

                        Timestamp( )public Timestamp(int year, int month, int date, int hour, int minute, 
        int second, int nano)
public Timestamp(long time)
Description

This constructor creates a new Timestamp object. The first prototype constructs a Timestamp for the year, month, date, hour, minute, second, and nanosecond specified. The second prototype constructs one based on the number of seconds since January 1, 1970, 12:00:00 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required