my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Convert Calendar to java.sql.Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Convert Calendar to java.sql.Date" Watch "Convert Calendar to java.sql.Date" New topic
Author

Convert Calendar to java.sql.Date

Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Hi guys,

In my project I am having a situation like this.

I have the Calendar object.

I have to convert it into java.sql.Date object.

Can you give the code for that.

Thanks for your comments.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Here is a big hint.
See the java.sql.Date constructor ? It takes an long as parameter, representing the time in millisecs.
Which method from Calendar can return the time in millisecs ?


[My Blog]
All roads lead to JavaRanch
Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Thanks Satou,

I got it
 
jQuery in Action, 2nd edition
 
subject: Convert Calendar to java.sql.Date