PowerShell: Date

By Xah Lee. Date: .
# print today's date
Get-Date

# other formats

Get-Date -Format "yyyy-MM-dd"
# 2021-05-11

Get-Date -Format "yyyyMMdd"
# 20210511

Get-Date -Format "yyyy-MM-ddTHH:mmK"
# 2021-05-11T14:42-07:00

Get-Date -Format "yyyy-MM-dd dddd"
# 2021-05-11 Tuesday

Get-Date -Format "dddd MM/dd/yyyy HH:mm K"
# Tuesday 05/11/2021 14:44 -07:00

PowerShell

How-to

Advanced

Script Examples