PowerTip: Use PowerShell to Create a Date String

Doctor Scripto

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



Discussion is closed.

Feedback usabilla icon