Click to See Complete Forum and Search --> : date help


esthera
03-30-2005, 04:32 AM
I am trying to make a function where I can pass in any date (such as 3/25/2005) and it willl return the friday before at 0000 as begdate and the thursday at 23:59 as the enddate.

can someone help me with this function?

buntine
03-30-2005, 05:05 AM
This may get a little sticky, but the idea is to process a certain date and determine which weekday it falls on and how far from Friday that day is (between 1 and 6), and then use the DateAdd() VBScript function to subtract that amount of days from the specified date.

Use the following to get the weekday name

Dim strWeekday: strWeekday = WeekDayName(WeekDay(yourDate))

Documentation for the DateAdd function can be found here: http://17.webmasters.com/caspdoc/html/vbscript_dateadd_function.htm

Regards.