PowerTip: Find Day of the Week by Using PowerShell

Summary: Use Windows PowerShell to find the day of the week.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily find the day of the week—for example, Monday,
          Tuesday, or Wednesday?

Hey, Scripting Guy! Answer Use the Get-Date cmdlet to return a DateTime object, and ten select the DayOfTheWeek property:


Comments (5)

  1. Chen V says:

    Looks simple and straight but very powerful when we use this in Script. 🙂

  2. Sam Henn says:

    This is not as simple. The answer by using ‘DayOfWeek’ property depends on the cultural settings on your Windows system. For example on mine is French, so today on Monday it returns 1.

  3. Sam Henn says:

    Oh I meant using DayOfWeek.Value__ which returns the number of the day in the week… SOrry for the confusion.
    DayOfWeek works fine whatever the culture settings.

  4. Vishe says:

    very easy ….