Created
March 15, 2017 16:13
-
-
Save markwragg/85645571a2c408553d86bfac72e87f9f to your computer and use it in GitHub Desktop.
A PowerShell function to return the salutation for the part of day it is currently, either Morning, Afternoon or Evening.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-PartOfDay { | |
Param ( | |
[int]$Hour = (Get-Date).Hour | |
) | |
Switch ($Hour) { | |
{$_ -in 0..11} {'Morning'} | |
{$_ -in 12..17} {'Afternoon'} | |
{$_ -in 18..23} {'Evening'} | |
} | |
} | |
"Good $(Get-PartOfDay)!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment