Someone please explain how Calendar.get(cal.DAY_OF_WEEK) gives correct output while cal.DAY_OF_WEEK is default and not modified? [duplicate]
问题 This question already has answers here : Java Calendar always shows the same time (5 answers) Calendar.Month gives wrong output (3 answers) Closed 10 months ago . I want to get the day for the date. When i set the date in cal.set(year,month-1,day), Sets the values for the calendar fields YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, and MINUTE . Previous values of other fields are retained. Thus, when I do cal.DAY_OF_WEEK, I will get the values which were existing already. But how does the cal.get