0

I´m wring an App which checks if today is for example if its at the moment sunday.

I have Date today = new Date(); and i want to know if it is a sunday

Steffen Bauer
  • 145
  • 1
  • 10
  • The information you need is at https://stackoverflow.com/questions/4822852/how-to-get-the-day-of-week-and-the-month-of-the-year#4822882 . – dat Jun 06 '17 at 23:16

1 Answers1

2

Date .getDay() is @deprecated so I suggest that you use Calendar

    Calendar cal = Calendar.getInstance();
    int day = cal.get(Calendar.DAY_OF_WEEK);
    if(Calendar.SUNDAY == day) {
        ...
    }
Smaniotto
  • 404
  • 4
  • 16