Returns true if the given date is a U.S. federal holiday.
Test-USFederalHoliday.ps1 [-Date] <DateTime> [-AsHolidayName] [-SatToFri] [-SunToMon]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
The following holidays are checked:
* New Year's Day, January 1 (± 1 day, if observed)
* Birthday of Martin Luther King, Jr., Third Monday in January
* Washington's Birthday, Third Monday in February
* Memorial Day, Last Monday in May
* Juneteenth, June 19 (± 1 day, if observed)
* Independence Day, July 4 (± 1 day, if observed)
* Labor Day, First Monday in September
* Columbus Day, Second Monday in October
* Veterans Day, November 11 (±1 day, if observed)
* Thanksgiving Day, Fourth Thursday in November
* Christmas Day, December 25 (±1 day, if observed)
Test-USFederalHoliday.ps1 2016-11-11
Veterans Day
Test-USFederalHoliday.ps1 2017-02-20
Washington’s Birthday
if(Test-USFederalHoliday.ps1 (Get-Date)) { return }
Returns from a function or script if today is a holiday.
The date to check.
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Return the holiday name?
Type: SwitchParameter
Parameter Sets: (All)
Aliases: ReturnName, ReturnHolidayName
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Indicates Saturday holidays are observed on Fridays.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Indicates Sunday holidays are observed on Mondays.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Thanks to the Uniform Monday Holiday Act, Washington’s “Birthday” always falls between Washington’s birthdays. He had two, and we still decided to celebrate a third day.
https://en.wikipedia.org/wiki/Uniform_Monday_Holiday_Act
https://en.wikipedia.org/wiki/Washington%27s_Birthday#History