Learn about Redwood and be one of the first to join the conversation

Visit Redwood Community
Hours between dates excluding weekend — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Hours between dates excluding weekend

Question
1
Views
0
Comments

So I have found the formula here and on MOS for calculating the days between dates and excluding Sat/Sun. But our SLA's are 24 or 48 hours for some tasks so I want the hours because 1 for days doesn't tell us any thing.

Is there a way to change this formula to count hours that are not Saturday or Sunday between dates?

CASE WHEN DAYOFWEEK("start_date") > DAYOFWEEK("end_date")

THEN CASE WHEN DAYOFWEEK("start_date") = 7

THEN TIMESTAMPDIFF(SQL_TSI_DAY, "start_date", "end_date") - (Floor(TIMESTAMPDIFF(SQL_TSI_DAY, "start_date", "end_date")/7)*2)-1

ELSE TIMESTAMPDIFF(SQL_TSI_DAY, "start_date", "end_date") - (Floor(TIMESTAMPDIFF(SQL_TSI_DAY, "start_date", "end_date")/7)*2)-2 END

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!