PowerTip: Customize How PowerShell Displays a Date

Doctor Scripto

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”


Discussion is closed.

Feedback usabilla icon