Name

Date

Synopsis

A wrapper around the java.util.Date class that adjusts the time value (milliseconds since January 1, 1970 0:00:00 GMT) to conform to the SQL DATE specification. The DATE type only deals with the day, month, and year, so the hours, minutes, seconds, and milliseconds are set to 00:00:00.00 in the current time zone. The Date class also includes a static valueOf() method that decodes the JDBC Date escape syntax yyyy - mm - dd into a Date value.

                  
public class Date extends java.util.Date {
// Public Constructors
   public Date( long date);  
   public Date( int year, int month, int day);                   // #
                  // Public Class Methods
   public static java.sql.Date valueOf( String s);  
// Public Methods Overriding Date
   public void setTime( long date);  
   public String toString();  
// Deprecated Public Methods
   public int getHours();                                        // Overrides:Date, #
   public int getMinutes();                                      // Overrides:Date, #
   public int getSeconds();                                      // Overrides:Date, #
   public void setHours( int i);                                 // Overrides:Date, #
   public void setMinutes( int i);                               // Overrides:Date, #
   public void setSeconds( int i);                               // Overrides:Date, #
}

Passed To

CallableStatement.setDate(), PreparedStatement.setDate(), java.sql.ResultSet.updateDate(), SQLOutput.writeDate(), javax.sql.RowSet.setDate()

Returned By

CallableStatement.getDate(), java.sql.Date.valueOf(), java.sql.ResultSet.getDate(), SQLInput.readDate()

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.