PowerShell Date Strings

Get-Date -f d
Get-Date -f yyyy-MM-dd

Get-Date -uf %s            # 1651326604.8135
Get-Date -uf %s -milli 0   # 1651326604

-Format uses .NET date format specifiers. -UFormat uses UFormat specifiers.

Links:


Abbreviated list of standard .NET date format specifiers (adapted from here)

d → 6/15/2009

D → Monday, June 15, 2009

g → 6/15/2009 1:45 PM

G → 6/15/2009 1:45:30 PM

m, M → June 15

r, R → Mon, 15 Jun 2009 20:45:30 GMT

t → 1:45 PM

T → 1:45:30 PM

U → Monday, June 15, 2009 8:45:30 PM

y, Y → June 2009

examples for en-US culture