cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Days to Hours whilst still excluding weekends.

Former Member
0 Kudos

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);

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

That works - Great thanks.

Probably need to start a new thread, but now I need to only count 1600-2400 as Sunday.

The workweek i want is Sunday 1600 to Friday 1800.

or the other way of saying it is I need to exclude Friday 1800 to Sunday 1600

Answers (1)

Answers (1)

Former Member
0 Kudos

Response was 100% accurate and extremely fast. Thanks