I have my date in string format and I want to convert it into date format. I also tried toDate(String) function. But it is not giving result. And I also tried following code:
The SimpleDateFormat constructor doesn't take the text to be parsed as argument, it takes the format description as argument. See the javadocs of the SimpleDateFormat class for a lengthy explanation of the available formats.
Originally posted by Amit Y Desai: SimpleDateFomat line is wrong... instead of passing actuall string to SimpleDateFormat,it should pass the pattern..
eg :-
Note that "mm/dd/yyyy" means most likely not what you think it means. "mm" is minutes, not months. Use "MM" for months. See the API documentation of class SimpleDateFormat for documentation about the format string.