PowerTip: Use PowerShell to Display Date Formats

PowerTip: Use PowerShell to Display Date Formats

  • Comments 7
  • Likes

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")

05/19/14

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

051914

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Why would you do this instead of calling 'Get-Date -Format MM/dd/yy' - wouldn't this return as a string as well?

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

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

  • Simple, but very useful !

    Thanks for sharing

  • thank you

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

  • Nice tip