View Full Version : Week ending date


IanT
03-13-2002, 03:59 AM
I want to calculate what the following week ending date (Fridays date) would be when given a specific date:

ie 13-03-02 = 15-03-02

Can anyone help.............

Harry
03-13-2002, 06:02 AM
Presuming that you won't be testing a date which is a Saturday then:

WeekEndDate = TestingDate + 6 - Weekday(TestingDate)

This is because weekday function returns number between 1-7 depending on the day where 1 = Sunday, 2 = monday etc. So the equation is basicaly saying add the difference between Friday (Day 6) and the tested dates day!

If you might be testing Saturday then use an Iif statement: IIf(Weekday(TestingDate)=7,TestingDate+6,TestingDa te + 6 - Weekday(TestingDate))

HTH