I need to parse a string like ‘February 12, 1981’ as a Date. I use SimpleDateFormat. But if I do:
new SimpleDateFormat('MMMMM dd, yyyy').parse('February 12, 1981')
I get java.text.ParseException.
I tried to reduce it to see where the problem is. First:
new SimpleDateFormat('MMMMM').parse('February')
works. Then:
new SimpleDateFormat('MMMMM dd').parse('February 12')
doesn’t work anymore. Anyone know why? I also tried new SimpleDateFormat('MMMMM' 'dd').
I’m using JRE 1.6.0_06.
What version of JDK/JRE are you using?
This works fine for me with 1.4.2_14, 1.5.0_16, and 1.6.0_07:
output: