Week ending date

IanT

Registered User.
Local time
Today, 04:59
Joined
Nov 30, 2001
Messages
191
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.............
 
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,TestingDate + 6 - Weekday(TestingDate))

HTH
 

Users who are viewing this thread

Back
Top Bottom