Powershell Golf: Next business day
powershell
Solution
This is pretty short too (but uses aliases):
,(1,2-eq7-(date).dayofweek)|%{(date)+"$(1+$_[0])"}
In one single statement:
(date)+"$(1+$(@(1,2-eq7-(date).dayofweek)))"
A few notes about this approach:
In Powershell (v1 at least), comparisons with collections return items where the condition is true, for example:
`PS> 1,2 -eq 1` `PS> 1`
I'm taking advantage of the fact that the actual exceptions to the rule `today + 1` to calculate the next business day are only Friday (+3 days) and Saturday (+2 days).
Problem
How to find next business day with powershell ?