title: Using Powershell how do you get the weekday number?
body: <p>Using a Powershell date object how do you get the day number of the week, 0 to 6 where 0 would be Sunday and 6 would be Saturday. I know that I can get the day name with the code below but how do I get the number as there is no DayNumberOfWeek or equivalent property?</p>
  
  <pre><code>(Get-Date).DayOfWeek
  </code></pre>
  
  <p>I suppose I could use the day name from the code above in a switch statement to convert it to a number but that doesn't seem to be very eloquent. </p>