DATEADD() Function To Find Closest Day Of Week, One Month Later.
Posted on 2004-08-05
I have a date challenge. I'm writing an ASP application that uses dateadd() to get the date of the next month and that is fine. I use this:
nextmonth = dateadd("m",1,date)
My issue is that I need the nextmonth value to be on the same day of the week as the starting date, for example, today is Thursday, 8/5/2004, the above function returns Saturday, 9/5/2004. I really need to calculate the closest Thursday to the nextmonth value which would be 9/2/2004.
I hope that someone has solved this issue and can be of help.