Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Convert Days to Hours whilst still excluding weekends.

I have created the following arguement to pull dates from a report not including weekends.

I need to be able to do one more thing - return the answer to be in hours not days, but still exclude the Weekends - as of now if I change it to hours, the weekends are counted.

Local DateTimeVar d1 := {TTS_NAFT.Date_Opened};Local DateTimeVar d2 := {TTS_NAFT.Date_Resolved};

NumberVar DaysDiff := DateDiff("d", d1, d2) -

DateDiff ("ww", d1, d2, crSaturday) -

DateDiff ("ww", d1, d2, crSunday);

Former Member
Former Member replied

Hi

Try the following :

Local DateTimeVar d1 := {TTS_NAFT.Date_Opened};Local DateTimeVar d2 := {TTS_NAFT.Date_Resolved};

Numbervar hrs;

NumberVar DaysDiff := DateDiff("d", d1, d2) -

DateDiff ("ww", d1, d2, crSaturday) -

DateDiff ("ww", d1, d2, crSunday);

hrs:=DaysDiff*24;

Thanks,

Sastry

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question