Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
This is probably a simple quick fix. I have a tfileinputdelimited(.csv file) that contains dates that are English (September 03, 2020). I need to convert it to French example(septembre 3 2020) format. What's the easiest way to approach this? I also forgot to include that I have code that indicate French or English so that would be taken into account.
Thanks,
You could create a user-routine, which converts English to French Dates in your above format like this:
public static String English2French(String dateString){
DateTimeFormatter formatterEnglish = DateTimeFormatter.ofPattern("MMMM dd, yyyy", Locale.ENGLISH);
DateTimeFormatter formatterFrench = DateTimeFormatter.ofPattern("MMMM dd, yyyy", Locale.FRENCH);
LocalDate localDate = LocalDate.parse(dateString, formatterEnglish);
return localDate.format(formatterFrench);
}
Call:
System.out.println(English2French("September 03, 2020"));