- 1

# Duration needs to be calculated in between two dates by excluding weekends and holidays

I have requirement to find the duration in minutes from two dates whose data type timestamp. need to calculate the duration by excluding weekends and holidays

1 Antwort

0

Finding duration between datetimes is relatively easy by using built-in datediff functions.
Subtracting weekends is a complicated computation that involves determining separately the number of Saturdays to subtract and the number of Sundays to subtract.
Then removing holidays requires a set of cumbersome logical and mathematical rules, such that it might be easier to use a lookup table that lists all holiday dates. Also be cognizant of overlap so as not to doubly subtract holiday dates that fall on a weekend.
I recommend searching the web for ideas. Then post your SQL query here if you need further specific help.