Skip to content
Advertisement

How to find last weekday of current month using SQL

How would I calculate the last weekday of the current month given a date using SQL?

I was able to get the last day of current month, but not sure how to do the last weekday programmatically.

I don’t want to generate a calendar look-up table.

Here’s the last day of month code i’m currently using:

Advertisement

Answer

I know it is not the most intuitive or effective or easy way of doing it. But here is my solution to find the last Weekday of the month…

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement