How to find the day of the week by date? There is such code:

Calendar c = Calendar.getInstance(); Integer dayOfWeek = c.get(Calendar.DAY_OF_WEEK); 

In it, I recognize the day in the week from 1 to 7.

The problem is that I can't find out the changed day in the week using the datepicker. For example, the initial activity is the date 07/14/2017 (day in the week is 1, because Sunday).

I change the date to another number and I can not get a new day in the week, I get the old one.

    1 answer 1

     Calendar c = Calendar.getInstance(); c.setTime(yourDate); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);