This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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