August 20th, 2013

PowerTip: Customize How PowerShell Displays a Date

Doctor Scripto
Scripter

Summary: Easily customize the way Windows PowerShell displays a date.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily display the date as day-dash-month-dash-four-digit year?

Hey, Scripting Guy! Answer Use the Get-Date cmdlet,specify a custom format by using the Format parameter, and use dd for the date, M for the month and yyyy for a four-digit year (this is case sensitive):

Get-Date -Format “dd-M-yyyy”

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.