Name

Date

Synopsis

Class Name: java.sql.Date

Superclass: java.util.Date

Immediate Subclasses: None

Interfaces Implemented: None

Availability: JDK 1.1

Description

This class deals with a subset of functionality found in the java.util.Date class. It specifically worries only about days and ignores hours, minutes, and seconds.

Class Summary

public class Date extends java.util.Date {
    static public Date valueOf(String s);
    #public Date(int year, int month, int day);
    public Date(long date);
    public void setTime(long date);
    public String toString( );
}

Class Methods

valueOf( )

static public Date valueOf(String s)
Description

Given a String in the form of yyyy-mm-dd, this method will return a corresponding instance of the Date class representing that date.

Object Constructors

Date( )

public Date(long date)
Date( )public Date(int year, int month, int day)
Description

Date ( ) constructs a new Date instance. Constructing a Date requires use of the new JDK 1.2 Date(long) constructor. The date argument specifies the number of milliseconds since January 1, 1970 00:00:00 GMT. A negative number represents the milliseconds before that date. The second, deprecated constructor naturally should never be used since it is ambiguous with respect to calendar and time zone.

Object Methods

setTime( )

public void setTime(long date)
Description

This method sets the time represented by this Date object to the specified number of milliseconds ...

Get Database Programming with JDBC & Java, 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.