Originally posted by Srividya Shiv:
The Calendar.setTime(Date)does not serve my purpose.
This statement confuses me, this is how the API's intend for this operation to occur. The code to do this is
Calendar c = new GregorianCalendar();
c.setTime(dateIn);
c.get(Calendar.YEAR);
This assumes that dateIn is of type java.sql.Date. This will reassign the values of the Calendar refernce to the Gregorian Calendar Object to the dateIn. Note, to assure all the fields in the GregorianCalendar object represent your date, it is necessary to call a get() on the object (This is a bug IMHO but, it's how the GregorianCalendar works so...)
I hope this helps