Given the number of days since a day which is a Thursday, the day number of the week is simply: (number_of_days + 4) % 7 No need for Zeller's congruence.