Functions timeToYear and timeToWeekday