There is a date of the view “2015-05-15”. How to make the date of the species “May 15, 2015”?
Answer 1, Authority 100%
Using SimpleDateFormat
(in order to “May” managed in Russian, it is necessary, respectively, locale). Example:
string olddatestring = "2015-05-15";
SimpleDateFormat OldDateFormat = New SimpleDateFormat ("YYYY-MM-DD", Locale.GetDefault ());
SimpleDateFormat NewDateFormat = New SimpleDateFormat ("DD Mmmm Yyyy", Locale.GetDefault ());
Date Date = oldDateFormat.Parse (OldDateString);
String Result = NewDateFormat.Format (Date);
Answer 2, Authority 64%
In addition to the above, I propose to use new classes from the java.time package, which appeared in Java 8, and not to use long-stayed java.util.date
string datestring = "2015-05-15";
LocalDate Date = LocalDate.Parse (DateString, dateTimeFormatter.Offattern ("Yyyy-Mm-DD"));
System.Out.PrintLN (date.format ("DD Mmmm Yyyy", New Locale ("RU"))));