Forum Moderators: open

Message Too Old, No Replies

Finding a week with a day in VBscript

         

korkus2000

6:39 pm on Oct 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am passing a day value. I want to take that value and find the date range from sunday to saturday of the week that the day falls in. I was wondering if anyone had an easy way of doing this in vbscript and asp. The date passed will be in mm/dd/yyyy. Basically I want the mm/dd/yyyy of the sunday before or on and the saturday after or on if that makes sense.

tomasz

8:29 pm on Oct 15, 2002 (gmt 0)

10+ Year Member



Try this

intstart = Weekday(sDate)
preSunday = DateAdd("d", 1 - intstart, sDate)
nextSaturday = datead("d", 6 - intstart)
I did not test but I think it should work , Weekday(Sunday)=1

tomasz

8:31 pm on Oct 15, 2002 (gmt 0)

10+ Year Member



sorry typo

intstart = Weekday(sDate)
preSunday = DateAdd("d", 1 - intstart, sDate)
nextSaturday = dateadd("d", 6 - intstart,sDate)