dcsimg
Converting Date object to a Calender object.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Venkatraghu_Kalkunda
Posted On:   Tuesday, December 7, 2004 12:35 PM


I am retreiving a Date object from a DB2 table.
Date dt = ResultSet.getDate("DATE");
I would like to use the date of this object to do some mathematical calculations, like add 50 days and get the new date. Can somebody tell me how I can do this? The methods in the Date class has been deprecated and may create issues if I use those methods. I was thinking if I could convert the dt value into a calender object, I coudl use the Calender.add() method. Any suggestions!!!!

Re: Converting Date object to a Calender object.

Posted By:   Vijay_Dogra  
Posted On:   Tuesday, December 7, 2004 09:45 PM

You can convert the date object into the Calendar object with the following code:


Calendar d1 = Calendar.getInstance();

d1.setTime(Your date object);



Then u can continue your further operations using the Claendar object
About | Sitemap | Contact