Why there are two Date classes; one in java.util package and another in Java.sql?


Ans:From the JavaDoc of java.sql.Date: 
A thin wrapper around a millisecond value that allows JDBC to identify this as an SQL DATE value. A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT. 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.


Explanation: A java.util.Date represents date and time of day, a java.sql.Date only represents a date (the complement of java.sql.Date is java.sql.Time, which only represents a time of day, but also extends java.util.Date).  

People who read this post also read :



1 comments:

This is one of the best updation on this version
Thank you giving a lot of new topics to related this site
I am very happy about this information

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More