Skip to Content
Feb 28 at 06:42 PM

difference between two timestamps, excluding weekends

67 Views Last edit Feb 28 at 06:58 PM 3 rev


i need to calculate date difference between two timestamps (date+time), excluding weekends.


startdate = 23-02-2023 15:37:24

enddate = 28-02-2023 07:13:59

Since there is a weekend in between, I expect to have 2,65 as result, and not 4,65.

Can you please help?

This well-known formula does not work, because it's based on date only (without time):

DateTimeVar startdate := {table.startdate};

DateTimeVar enddate := {table.enddate};

Datediff("d", startdate, enddate) -

Datediff("ww", startdate, enddate, crSaturday)-

Datediff("ww", startdate, enddate, crSunday);

Thank you very much in advance.