i want to change Russian Date to US format
String rDate = "28 августа 2017";
output :
String usDate = "28-08-2017";
You can use DateTimeFormatter
with withLocale
.
Parsing text.
DateTimeFormatter dateTimeFormatter =
DateTimeFormatter
.ofPattern("dd MMMM uuuu")
.withLocale( new Locale("ru") )
;
LocalDate ld = LocalDate.parse(rDate, dateTimeFormatter);
Generating text.
String usDate = ld.format(DateTimeFormatter.ofPattern("dd-MM-uuuu"));
=> 28-08-2017
See this code run live at IdeOne.com.