aspose file tools*
The moose likes Java in General and the fly likes Convert java.util.Date to java.sql.Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Convert java.util.Date to java.sql.Date" Watch "Convert java.util.Date to java.sql.Date" New topic
Author

Convert java.util.Date to java.sql.Date

Kop Ite
Greenhorn

Joined: Aug 06, 2001
Posts: 9

Hi
I am trying to convert a java.util.Date into java.sql.Date as below:
java.util.Date aDate
(java.sql.Date) aDate
< where aDate = Mon Nov 11 00:00:00 GMT 2002 >
I am getting exception:
java.lang.ClassCastException: java.util.Date
How do I sort this out so it will work remembering that aDate value is set in stone, so nothing can be done with that, must be converted into java.sql.Date.
Help !!
thanks
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Kop Ite
Greenhorn

Joined: Aug 06, 2001
Posts: 9
thanks works a treat
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert java.util.Date to java.sql.Date