I want to parse date strings like "February 7, 2011"
using "M dd, yyyy"
format. But I get an exception.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Assuming you are using
SimpleDateFormat
, the month format is incorrect, it should beMMM dd, yyyy
MMM
will match the long text format of the month:You will want to use "MMM dd, yyyy"
See SimpleDateFormat
Try this code. I ran it with two dates "November 20, 2012" and "January 4, 1957" and got this output:
It works fine. Your regex was wrong.
February
you need to use an english Locale or it may fail if your default Locale is not in English