Monthly Archive

Categories

Get-Date -UFormat

The Get-Date -UFormat parameter formats the date using Unix format. The full list of format specifiers are in the Notes section of the Get-Date help file.

Some examples are:

PS> Get-Date -UFormat '%Y-%m-%d %H:%M%:%S%Z'
2019-05-27 20:40:11+01

 

4 digit year – two digit month and day. Hour in 24 hour format and minutes and seconds and finally time zone as offset from GMT

 

Date in locale format

PS> Get-Date -UFormat %x
05/27/19

though it shows a US format for a UK locale?

 

PS> Get-Date -UFormat '%A %d %B %Y'
Monday 27 May 2019

day of week – day – Month (full name) 4 digit year.

 

Between the Format parameter and the UFormat parameter you should be able to get the date information into any format you require

Comments are closed.