Код: Выделить всё
public static String formatDateByLocale(String date, String languageTag) {
Locale locale = Locale.forLanguageTag(languageTag);
String datePattern = DateTimeFormatterBuilder.getLocalizedDateTimePattern(FormatStyle.LONG, FormatStyle.LONG, Chronology.ofLocale(locale), locale);
DateTimeFormatter targetFormat = DateTimeFormatter.ofPattern(datePattern).withLocale(locale);
DateTimeFormatter currentFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm a");
LocalDateTime localDateTime = LocalDateTime.parse(date, currentFormat);
String result = targetFormat.format(localDateTime);
return result;
}
Как я должен подходить к этому, чтобы иметь эту дату: 17/04/2017 10:50 с тегом FR в 2017/04/17 10:50?>
Подробнее здесь: https://stackoverflow.com/questions/474 ... -java-time