How to Remove Weekends and Holidays from Datetime Functions

Hello does anyone have a way of excluding weekends [and US holidays] from datetime_add and datetime_diff ?

@emackie This is a good question. I haven’t seen anyone write this in GSQL yet. I’m not sure if there are tools out there that can pull that information automatically. You could put the holidays in an accum and then weekends in an accum. Here is a website that lists weekends. Saturdays In 2023 (List Of Saturdays In 2023) - Calcudater

If you do write the generic logic for your query it would be great if you could share it here in case others are also interested!

1 Like