fork download
  1. import java.time.LocalDate;
  2. import java.time.ZoneId;
  3. import java.time.format.DateTimeFormatter;
  4. import java.time.format.FormatStyle;
  5. import java.util.Locale;
  6.  
  7. public class Main {
  8. public static void main(String[] args) {
  9. DateTimeFormatter dtfDateFull = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
  10. .localizedBy(new Locale("cs", "CZ"));
  11. DateTimeFormatter dtfDateMedium = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)
  12. .localizedBy(new Locale("cs", "CZ"));
  13. DateTimeFormatter dtfDateShort = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT)
  14. .localizedBy(new Locale("cs", "CZ"));
  15.  
  16. LocalDate date = LocalDate.now(ZoneId.of("Europe/Prague"));
  17.  
  18. System.out.println(date.format(dtfDateFull));
  19. System.out.println(date.format(dtfDateMedium));
  20. System.out.println(date.format(dtfDateShort));
  21. }
  22. }
Success #stdin #stdout 0.22s 55428KB
stdin
Standard input is empty
stdout
neděle 18. července 2021
18. 7. 2021
18.07.21