Forums Register Login

Difference between sql.Date and util.Date

+Pie Number of slices to send: Send
What is the difference between sql.Date and util.Date

Please don't tell sql date is a sub-class of util.Date
+Pie Number of slices to send: Send
java.sql.Date exists to wrap the ANSI SQL DATE datatype. See the JavaDocs for more.
+Pie Number of slices to send: Send
could you please throw more light on this topic.
+Pie Number of slices to send: Send
java.sql.Date dosen't store millisecond information while java.util.Date does.
[ February 15, 2007: Message edited by: Srinivasa Raghavan ]
+Pie Number of slices to send: Send
Thanks srini.

But even sql.Date is having a constructor that takes milli seconds right?

I didn't fully understand your answer.
+Pie Number of slices to send: Send
From javadoc link in one of the responses:


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.

 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3205 times.
Similar Threads
Converting String to util.Date and then sql.Date
Converting string to util.date & then sql.date to query a table
util.Date to sql.Date
util.date and sql.date - Difference
util.Date to sql.Date
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:39:47.