PowerTip: Use PowerShell to Display Date Formats

Summary: Use Windows PowerShell to easily change the way the date displays on your computer.

Hey, Scripting Guy! Question How can I use Windows PowerShell to display the date on my computer as a two-digit month, two-digit day,
          and two-digit year?

Hey, Scripting Guy! Answer Use the ToString() method from the Get-Date cmdlet. Here are two examples:

PS C:\> (get-date).tostring("MM/dd/yy")


PS C:\> (get-date).tostring("MMddyy")


Comments (7)

  1. I have used the ToString() method several times. Comes in very handy, thanks for sharing!

  2. Durval Ramos says:

    Simple, but very useful !

    Thanks for sharing

  3. Chen V says:

    Sorry I mean (Get-Date).ToShortDateString()

  4. Chen V says:

    Good tip. How about (get-date).toshortdatetime()

  5. David says:

    Why would you do this instead of calling ‘Get-Date -Format MM/dd/yy’ – wouldn’t this return as a string as well?