I want to know the N-th time a weekday is occurring inside a given month, based on ( Date , Week day, Month and Year ).
I looked at similar questions:
How can I get the 3rd Friday of a month in Python?
The solutions for that question only concentrate on 3rd friday, but I want to be able to generalize it all week days and get the n-th time they are repeating in a month.
I also checked:
How do I get the day of week given a date in Python?
Count of weekdays in a given month
But they don't align exactly with what I'm looking for.
Ex: Given a date ( 1, Tuesday , October, 2019 ), the program should return 1, because it's the first Tuesday of the month; similarly ( 12, Saturday, October , 2019 ) should return 2 as it's second Saturday of the month.
Any help is appreciated. TIA.