Converting a String to Date
I have a String in which i am storing the date which I have retrieved from database. How can I convert this String to a Date object and use Comparator for sorting.
String strCreatedDate1 = ((CVendorEmployees) vendoremployee1).getCreatedDate().toUpperCase();
The date format which I will retrieve from String is mm/dd/yyyy.
I want to convert this into date and use it for sorting.
Thanx.
[417 byte] By [
beejuma] at [2007-11-27 9:51:11]

# 2
> Date dtTmp = new
> SimpleDateFormat("dd-MM-yyyy").parse(((CVendorEmployee
> s) vendoremployee1).getCreatedDate());
> Calendar calendar = Calendar.getInstance();
> calendar.setTime(dtTmp);
>
> Now you have the date object do what ever you wish to
Better make thatnew SimpleDateFormat("MM/dd/yyyy")
And no need for the Calendar stuff if all you want is a Date object.
dwga at 2007-7-13 0:20:13 >
