fork download
  1. import java.time.*;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. // ZoneId.systemDefault() gives you the ZoneId set to the JVM.
  6. // Change it as per your requirement e.g. ZoneId.of("Europe/London")
  7. LocalDate today = LocalDate.now(ZoneId.systemDefault());
  8.  
  9. DayOfWeek dow = today.getDayOfWeek();
  10.  
  11. if (dow == DayOfWeek.SATURDAY || dow == DayOfWeek.SUNDAY) {
  12. System.out.println("Weekend");
  13. // Rest of the processing
  14. } else {
  15. System.out.println(dow);
  16. // Rest of the processing
  17. }
  18. }
  19. }
Success #stdin #stdout 0.11s 53840KB
stdin
Standard input is empty
stdout
THURSDAY