aspose file tools
The moose likes Beginning Java and the fly likes Difference between sql.Date and util.Date Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Difference between sql.Date and util.Date" Watch "Difference between sql.Date and util.Date" New topic
Author

Difference between sql.Date and util.Date

rama murthy
Ranch Hand

Joined: Jan 13, 2006
Posts: 82
What is the difference between sql.Date and util.Date

Please don't tell sql date is a sub-class of util.Date
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

java.sql.Date exists to wrap the ANSI SQL DATE datatype. See the JavaDocs for more.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
rama murthy
Ranch Hand

Joined: Jan 13, 2006
Posts: 82
could you please throw more light on this topic.
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
java.sql.Date dosen't store millisecond information while java.util.Date does.
[ February 15, 2007: Message edited by: Srinivasa Raghavan ]

Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
rama murthy
Ranch Hand

Joined: Jan 13, 2006
Posts: 82
Thanks srini.

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

I didn't fully understand your answer.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1348
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.

 
I agree. Here's the link: jrebel
 
subject: Difference between sql.Date and util.Date
 
Similar Threads
util.Date to sql.Date
Converting String to util.Date and then sql.Date
util.date and sql.date - Difference
Converting string to util.date & then sql.date to query a table
util.Date to sql.Date