Autoeng
Why me?
- Local time
- Today, 17:36
- Joined
- Aug 13, 2002
- Messages
- 1,302
I have a query to calculate DateDiff that is not returning the correct result. Can anybody see what is incorrect here? We do not work on Fridays, Saturdays or Sundays.
Thanks to pdx_man for previously posting the example that I based my query on.
DateDiff("d",[RelDate],[ImpDate],2) AS DaysDiff, Int([daysdiff]/7) AS Weeks, [daysdiff]-[weeks]*3+IIf(Weekday([ImpDate],2)>5,5-Weekday([ImpDate],2),0)+IIf(Weekday([RelDate],2)=6,1,0)+1 AS weekdays
For example if RelDate was 6/14/02 and ImpDate was 7/22/02 the weekdays return should be 21 but I am getting 24.
Autoeng
Thanks to pdx_man for previously posting the example that I based my query on.
DateDiff("d",[RelDate],[ImpDate],2) AS DaysDiff, Int([daysdiff]/7) AS Weeks, [daysdiff]-[weeks]*3+IIf(Weekday([ImpDate],2)>5,5-Weekday([ImpDate],2),0)+IIf(Weekday([RelDate],2)=6,1,0)+1 AS weekdays
For example if RelDate was 6/14/02 and ImpDate was 7/22/02 the weekdays return should be 21 but I am getting 24.
Autoeng
Last edited: