fork download
  1. import java.time.OffsetDateTime;
  2. import java.time.format.DateTimeFormatter;
  3. import java.util.Locale;
  4.  
  5. class Main {
  6. public static void main(String[] args) {
  7. OffsetDateTime odt = OffsetDateTime.now().plusDays(1);
  8. DateTimeFormatter formatter = DateTimeFormatter
  9. .ofPattern(String.format("EEEE d'%s' MMMM uuuu", dateSuffix(odt.getDayOfMonth())), Locale.FRANCE);
  10. System.out.println(odt.format(formatter));
  11. }
  12.  
  13. static String dateSuffix(final int dayOfMonth) {
  14. return (dayOfMonth % 30 == 1 || dayOfMonth == 1) ? "er" : "\0";
  15. }
  16. }
Success #stdin #stdout 0.19s 55744KB
stdin
Standard input is empty
stdout
vendredi 2 décembre 2022