static int invertWeekdayNum ( WeekdayNum weekdayNum , Weekday dow0 , int nDays ) { assert weekdayNum . num < 0 ; // how many are there of that week? return countInPeriod ( weekdayNum . wday , dow0 , nDays ) + weekdayNum . num + 1 ; }
Compute an absolute week number given a relative one . The day number - 1SU refers to the last Sunday so if there are 5 Sundays in a period that starts on dow0 with nDays then - 1SU is 5SU . Depending on where its used it may refer to the last Sunday of the year or of the month .