aspose file tools*
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

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Convert Calendar to java.sql.Date" Watch "Convert Calendar to java.sql.Date" New topic

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é

Joined: Nov 24, 2005
Posts: 14687

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
I agree. Here's the link:
subject: Convert Calendar to java.sql.Date
Similar Threads
compile error ?
Date format
HELP - java.sql.Date
Days between java.sql.Date and java.util.Date objects
Converting From String to java.sql.Date