Using a Powershell date object, how do you get the day of the week, 0-6, where 0 will be Sunday and 6 will be Saturday. I know that I can get the name of the day with the code below, but how can I get the number because there is no DayNumberOfWeek or equivalent property?
(Get-Date).DayOfWeek
I believe that I could use the day name from the above code in the switch statement to convert it to a number, but that doesn't seem very eloquent.
source share