PowerTip: Display the Date in Month, Day, Year Format

Doctor Scripto

Summary: Learn how to use Windows PowerShell to display the date in a month, day, and two-digit year format.

Hey, Scripting Guy! Question How can I use Windows PowerShell to display the date in a month, day, and two-digit number format with a hyphen between each of the elements?

Hey, Scripting Guy! Answer Use the ToString method from the Get-Date cmdlet and specify a pattern to achieve your desired results:

PS C:\> (get-date).ToString(“MM-dd-yy”)

03-11-13

0 comments

Discussion is closed.

Feedback usabilla icon