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

Advertisements
This entry was posted in Powershell Basics. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s