In java, both the java.util
and the java.sql
package contain a Date
class, So what is the difference between them?
If one
java.sql.Date accepts a long integer which represents the amount of milliseconds since January 1, 1970. If the given number is negative it refers time before January 1, 1970. Remember, the encapsulated value inside the object represents only date like January 1, 1970 and no time information is stored.
java.util.Date stores both date as well as time information. It is more commonly used than java.sql.Date.