Share via


Date Format Using PowerShell

Most of my friends says : Get-Date in PowerShell is awesome but not very friendly.

How you use the command matters a lot. Okay I asked them what is the difficulty you faced?

I could not meet my Manager reporting date format structure. Anything your manager needs should be in Gregorian calendar :)

Requirement:

Need to get Week day as "Mon" , "Tue"

Solution:

Cranky - Am I correct? Don't blame PowerShell - Refer to Text and Regular Expression and do more

Easy Way to do this:

Code:

  $date = Get-Date "{0:ddd}" -f $date "{0:dd}" -f $date "{0:zz}" -f $date

Enjoy PowerShell :)

Other Languages

This article is also available in the following languages: