Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Function to return date x business days from present, accounting for holidays?

$
0
0

Writing a notification script that sends an email with a date 5 business days in the future (e.g. normally one week), but it needs to be able to account for holidays as well.

Get-Date is working properly for weeks where there aren’t any holidays, but it needs to be able to add 1-2 days to AddDays(7) depending on the date.

Figuring out if the range is inclusive of a holiday is complicated when some holidays occur on the xth Monday of the month or whatever; makes it difficult to reason out the logic…

Do I need to parse the whole calendar year to get concrete dates without having to recode this every year?

Any tips?

submitted by /u/rmg22893
[link] [comments]

The post Function to return date x business days from present, accounting for holidays? appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Latest Images

Trending Articles



Latest Images