How to convert a string date with a full month name into a date object in Java?
•
Java
How to convert a date with a full month name into a date object in Java? This is the sample I need to convert. Date: December 6, 2002
thank you.
Solution
String str = "6 December 2002";
String str = "6 December 2002"; DateFormat formatter = new SimpleDateFormat("dd MMM yyyy"); Date date = (Date)formatter.parse(str);
> Here is working IDE One demo
Must see
> API Doc
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码