top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

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

0 votes
127 views
Why there are two Date classes; one in java.util package and another in java.sql?
posted Feb 17, 2016 by Karthick.c

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The package java.util.Date is used for date and time but java.sql.Date is use for date and its complement java.sql.Time is used for time purpose and difference in both date classes are:
1. method toString() represents different string representation.like yyyy-mm-dd.
2. a static valueOf(String) method which create a date from above string.
3. getters and setters methods are deprecated. and java.sql.Date is used with JDBC.

answer Feb 26, 2016 by Shivam Kumar Pandey
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...