November 7th, 2013

PowerTip: Use PowerShell to Create a Date String

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to create a date string that has a month, day, and year.

Hey, Scripting Guy! Question How can I use Windows PowerShell to create a string that represents the date with the month, day, and year?

Hey, Scripting Guy! Answer Feed a pattern of ‘M/d/y’ to the ToString method from Get-Date:

PS C:\> (get-date).ToString(‘M/d/y’)

10/28/13

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.