1

Having trouble getting the day of the week. Today is Monday and it should return 2 as Monday is a second day in the week of the Calendar class. But for me it returns 7!!! Why??? the c.getFirstDayOfWeek() returns 1 as normal...

    Calendar c = Calendar.getInstance();
    System.out.println("inside the loop +"+ c.getFirstDayOfWeek() + "    " + c.DAY_OF_WEEK);
Tad Lithuania
  • 105
  • 1
  • 9

2 Answers2

5

Calendar.DAY_OF_WEEK is simply a constant to be used with Calendar's methods.

You will want to use c.get(Calendar.DAY_OF_WEEK)

Dragondraikk
  • 1,659
  • 11
  • 21
0

It returns first day of week. Eg: It Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France. 1-Sunday 2-Monday and etc.,

Gnanadurai A
  • 278
  • 1
  • 2
  • 15