java - What does cal.get(7) do from a Calender instance? -
i documenting code , need understanding little line.
private calendar cal = calendar.getinstance(); if ((this.cal.get(7) != 7) || (this.cal.get(7) == 1)) {
what cal.get(7)
mean? ran on ide, , gave me result of 5. tried cal.get(6)
, , got result of 169.
if "cal" java.util.calendar, 7 day_of_week. however, shouldn't pass literal integers .get() method; use constants on calendar class instead. so, instance, equivalent of example:
if ((this.cal.get(calendar.day_of_week) != calendar.saturday) || (this.cal.get(calendar.day_of_week) == calendar.sunday)) {
(day_of_year has value of 6, way)
the calendar class has large number of constants can use; see javadoc more info.
Comments
Post a Comment