doubledate.weekdayof#
- doubledate.weekdayof(frequency: str, date=None, *, base=1)#
Returns the number of weeks since the start of the frequency assuming the week starts on the same weekday as the date given.
- Parameters:
frequency (str) – one of Y, H, T, Q, M
date (datetime-like) – the date
base (int) – whether to consider the first date as 0 or 1
Examples
>>> weekdayof("Y", datetime.date(2020,1,27)) 4 #4th Monday of the year
>>> weekdayof("Y", datetime.date(2020,6,17)) 25 #25th Tuesday of the year
>>> weekdayof("M", datetime.date(2020,3,31)) 5 #5th Tuesday of March