For the constructor you need to pass the pattern in which the date string is received.
For the parse method you need to pass the strInputDate
There is a mistake in the code i gave in earlier post. The method should be 'parse' not 'format'
Joined: Sep 01, 2006
that means even i pass 2010å¹´2æ25æ¥ to format.parse will it work ??
Check out SimpleDateFormat. Your string has the following parts:
- the month in short format. The month is M. Try using M, MM, MMM, MMMM etc and see what that does.
- a space
- the day of month. That's d. Try using d, dd, ddd etc and see what that does.
- a comma
- the year. That's y. Again, try using y, yy, yyy, yyyy etc and see what that does.
You may want to try formatting first. For example:
This will help you out with how many M's, d's and y's you need.
i have defined patternd as
SimpleDateFormat date= new SimpleDateFormat("MMM dd, yyyy",locale);
. when when my broswer language is set to english
Date - Feb 26, 2010 System.out.println(date.format(new Date())); is printed as Feb 26, 2010
but when language ,local is fr_FR then it prints févr. 26, 2010 Dot . is inserted dont know why which gives unparseable error