top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

0 votes
149 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
...