Das habe ich bisher getan:
Code: Select all
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;
}
Wie soll ich vorgehen, damit das Datum 17.04.2017 10:50 Uhr mit FR-Tag in 2017/04/17 10:50 Uhr umgewandelt wird?
Mobile version