java.util.Date
represents a specific instant in time with millisecond precision. It represents both date and time information without timezone. The java.util.Date class implements Serializable, Cloneable and Comparable interface. It is inherited by java.sql.Date
, java.sql.Time
and java.sql.Timestamp
interfaces.
java.sql.Date
extends java.util.Date class which represents date without time information and it should be used only when dealing with databases. To conform with the definition of SQL DATE, the millisecond values wrapped by a java.sql.Date
instance must be 'normalized' by setting the hours, minutes, seconds, and milliseconds to zero in the particular time zone with which the instance is associated.
It inherits all public methods of java.util.Date
such as getHours()
, getMinutes()
, getSeconds()
, setHours()
, setMinutes()
, setSeconds()
. As java.sql.Date
does not store the time information, it override all the time operations from java.util.Date
and all of these methods throw java.lang.IllegalArgumentException
if invoked as evident from their implementation details.