I am looking for a TSQL code that would calculate a specific date each month that varies based on the following condition:
I need the result that would return the date of the Thursday after the Last Wednesday of each month.
I'm guessing a code that would be (Last Wednesday of Month) + 1 Day.
My problem is I can find ways to calculate a day within a week, the last day or first day of a month, add/subtract as needed from that. But calculating the last Wednesday of a month I can't figure out how to do.
As an example the dates I would need returned at 1/31/08, 2/28/08, 3/27/08, 5/1/08, 5/29/08 ......
This is my first time here so hopefully this is in the correct place and the correct format. If not please let me know and accept my apoligies from the newbie. I appreciate any advice that may be provided.
Thanks,
Chad
I need the result that would return the date of the Thursday after the Last Wednesday of each month.
I'm guessing a code that would be (Last Wednesday of Month) + 1 Day.
My problem is I can find ways to calculate a day within a week, the last day or first day of a month, add/subtract as needed from that. But calculating the last Wednesday of a month I can't figure out how to do.
As an example the dates I would need returned at 1/31/08, 2/28/08, 3/27/08, 5/1/08, 5/29/08 ......
This is my first time here so hopefully this is in the correct place and the correct format. If not please let me know and accept my apoligies from the newbie. I appreciate any advice that may be provided.
Thanks,
Chad
Comment