fork download
  1. import java.time.LocalDate;
  2. import java.time.MonthDay;
  3. import java.time.format.DateTimeFormatter;
  4. import java.util.Locale;
  5.  
  6. class Main {
  7. public static void main(String[] args) {
  8. // Test
  9. System.out.println(weekdayMonthDayFormatted("15", "7"));
  10. }
  11.  
  12. static String weekdayMonthDayFormatted(String day, String month) {
  13. MonthDay md = MonthDay.of(Integer.parseInt(month), Integer.parseInt(day));
  14.  
  15. // I have used 2014 here just for the demo. Replace 2014 with the applicable
  16. // year e.g. for the current year, replace it with Year.now().getValue()
  17. LocalDate date = md.atYear(2014);
  18.  
  19. DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEEE MMMM dd", Locale.ENGLISH);
  20. return date.format(formatter);
  21. }
  22. }
  23.  
Success #stdin #stdout 0.16s 56136KB
stdin
Standard input is empty
stdout
Tuesday July 15