Is your algorithm request related to a computational problem? Please describe.
I am working on some automation stuff, I need to get 1st, 2nd 3rd, 4th or last of specific weekdays in the month, so I plan to implement a code to get the day of the week with order (Ex: 1st Sunday, 2nd Monday...) from the date or get a date of specific day of the week from the month or year input.
Describe the solution you'd like
For Get the Day of the Week from a Specific Date, I am going to get the dateValue.DayOfWeek from the DateTime parameter in the function then check if that DateTime -7 is from the same month or not to check on the occurrence of that particular weekday in the month previously. For get a date of specific day of the week from the month or year input, I am planning to do the similar stuff from before. Getting the 1st of the month, check dateValue.DayOfWeek add it according to the week of day want to find (1: Monday, 2: Tuesaday...) and the occurence wanted (1st, 2nd....) then proceed with DateTime + 7 with occurence count.
Describe alternatives you've considered
Looping through the date of month to get first week of day needed.
Additional context
Add any other context or screenshots about the feature request here.
Is your algorithm request related to a computational problem? Please describe. I am working on some automation stuff, I need to get 1st, 2nd 3rd, 4th or last of specific weekdays in the month, so I plan to implement a code to get the day of the week with order (Ex: 1st Sunday, 2nd Monday...) from the date or get a date of specific day of the week from the month or year input.
Describe the solution you'd like For Get the Day of the Week from a Specific Date, I am going to get the dateValue.DayOfWeek from the DateTime parameter in the function then check if that DateTime -7 is from the same month or not to check on the occurrence of that particular weekday in the month previously. For get a date of specific day of the week from the month or year input, I am planning to do the similar stuff from before. Getting the 1st of the month, check dateValue.DayOfWeek add it according to the week of day want to find (1: Monday, 2: Tuesaday...) and the occurence wanted (1st, 2nd....) then proceed with DateTime + 7 with occurence count.
Describe alternatives you've considered Looping through the date of month to get first week of day needed.
Additional context Add any other context or screenshots about the feature request here.