Skip to content

Instantly share code, notes, and snippets.

@RichieBzzzt
Created July 21, 2017 12:04
Show Gist options
  • Save RichieBzzzt/ba58dd009c241699882559aaca9feaee to your computer and use it in GitHub Desktop.
Save RichieBzzzt/ba58dd009c241699882559aaca9feaee to your computer and use it in GitHub Desktop.
Function Get-DaysofWeek {
[CmdletBinding()]
param
(
[System.Collections.Generic.List[Int]]
[ValidateNotNullorEmpty()]
$Enum
)
$daysofWeek = New-Object "System.Collections.Generic.List[String]"
if (($Enum -contains 1) -eq $True) {$daysofWeek.Add("Sunday")}
if (($Enum -contains 2) -eq $True) {$daysofWeek.Add("Monday")}
if (($Enum -contains 4) -eq $True) {$daysofWeek.Add("Tuesday")}
if (($Enum -contains 8) -eq $True) {$daysofWeek.Add("Wednesday")}
if (($Enum -contains 16) -eq $True) {$daysofWeek.Add("Thursday")}
if (($Enum -contains 32) -eq $True) {$daysofWeek.Add("Friday")}
if (($Enum -contains 64) -eq $True) {$daysofWeek.Add("Saturday")}
if (($Enum -contains 65) -eq $True) {$daysofWeek.Add("Weekdays")}
if (($Enum -contains 62) -eq $True) {$daysofWeek.Add("Weekends")}
if (($Enum -contains 127) -eq $True) {$daysofWeek.Add("EveryDay")}
Return $daysofWeek
}
cls
$range = 2,8,32
$numbers = New-Object "System.Collections.Generic.List[Int]"
$numbers = $range
$output = Get-DaysOfWeek -Enum $range
$output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment