d
| Day of the month as a number
between 1 and 31. Represents single-digit days without a leading
zero. | PS > "{0:%d}" -f
[DateTime] "01/02/4567"
2 |
dd
| Day of the month as a number
between 1 and 31. Represents single-digit days with a leading
zero. | PS > "{0:dd}" -f
[DateTime] "01/02/4567"
02 |
ddd
| Abbreviated name of the day of
week. | PS > "{0:ddd}" -f
[DateTime] "01/02/4567"
Fri |
dddd
| Full name of the day of the
week. | PS > "{0:dddd}" -f
[DateTime] "01/02/4567"
Friday |
f
| Most significant digit of the
seconds fraction (milliseconds). | PS > $date = Get-Date
PS > $date.Millisecond
93
PS > "{0:%f}" -f $date
0 |
ff
| Two most significant digits of
the seconds fraction (milliseconds). | PS > $date = Get-Date
PS > $date.Millisecond
93
PS > "{0:ff}" -f $date
09 |
fff
| Three most significant digits of
the seconds fraction (milliseconds). | PS > $date = Get-Date
PS > $date.Millisecond
93
PS > "{0:fff}" -f $date
093 |
ffff
| Four most significant digits of
the seconds fraction (milliseconds). | PS > $date = Get-Date
PS > $date.Millisecond
93
PS > "{0:ffff}" -f $date
0937 |
fffff
| Five most significant digits of
the seconds fraction (milliseconds). | PS > $date = Get-Date
PS > $date.Millisecond
93
PS > "{0:fffff}" -f $date
09375 |
ffffff
| Six most significant digits of
the seconds fraction (milliseconds). | PS > $date = Get-Date
PS > $date.Millisecond
93
PS > "{0:ffffff}" -f $date
093750 |
fffffff
| Seven most significant digits of
the seconds fraction (milliseconds). | PS > $date = Get-Date
PS > $date.Millisecond
93
PS > "{0:fffffff}" -f $date
0937500 |
F
FF
FFF
(...)
FFFFFFF
| Most significant digit of the
seconds fraction (milliseconds). When compared to the lowercase series of
'f ' specifiers, displays nothing if the number
is zero. | PS > "{0:|F FF FFF FFFF|}" -f
[DateTime] "01/02/4567"
| | |
%g or gg
| Era (e.g., A.D.). | PS > "{0:gg}" -f [DateTime]
"01/02/4567"
A.D. |
%h
| Hours, as a number between 1 and
12. Single digits do not include a leading zero. | PS > "{0:%h}" -f
[DateTime] "01/02/4567 4:00pm"
4 |
hh
| Hours, as a number between 01 and
12. Single digits include a leading zero. Note: This is
interpreted as a standard DateTime formatting string unless used
with other formatting specifiers. | PS > "{0:hh}" -f
[DateTime] "01/02/4567 4:00pm"
04 |
%H
| Hours, as a number between 0 and
23. Single digits do not include a leading zero. | PS > "{0:%H}" -f
[DateTime] "01/02/4567 4:00pm"
16 |
HH
| Hours, as a number between 00 and
23. Single digits include a leading zero. | PS > "{0:HH}" -f
[DateTime] "01/02/4567 4:00am"
04 |
K
| DateTime.Kind specifier that corresponds
to the kind (i.e., Local, Utc, or Unspecified) of input
date.
| PS > "{0:%K}" -f
[DateTime]::Now.ToUniversalTime()
Z |
m
| Minute, as a number between 0 and
59. Single digits do not include a leading zero. | PS > "{0:%m}" -f [DateTime]::Now
7 |
mm
| Minute, as a number between 00
and 59. Single digits include a leading zero. | PS > "{0:mm}" -f [DateTime]::Now
08 |
M
| Month, as a number between 1 and
12. Single digits do not include a leading zero. | PS > "{0:%M}" -f
[DateTime] "01/02/4567"
1 |
MM
| Month, as a number between 01 and
12. Single digits include a leading zero. | PS > "{0:MM}" -f
[DateTime] "01/02/4567"
01 |
MMM
| Abbreviated month
name. | PS > "{0:MMM}" -f
[DateTime] "01/02/4567"
Jan |
MMMM
| Full month name. | PS > "{0:MMMM}" -f
[DateTime] "01/02/4567"
January |
s
| Seconds, as a number between 0
and 59. Single digits do not include a leading
zero. | PS > $date = Get-Date
PS > "{0:%s}" -f $date
7 |
ss
| Seconds, as a number between 00
and 59. Single digits include a leading zero. | PS > $date = Get-Date
PS > "{0:ss}" -f $date
07 |
t
| First character of the a.m./p.m.
designator. | PS > $date = Get-Date
PS > "{0:%t}" -f $date
P |
tt
| a.m./p.m.
designator. | PS > $date = Get-Date
PS > "{0:tt}" -f $date
PM |
y
| Year, in (at most) two
digits. | PS > "{0:%y}" -f
[DateTime] "01/02/4567"
67 |
yy
| Year, in (at most) two
digits. | PS > "{0:yy}" -f
[DateTime] "01/02/4567"
67 |
yyy
| Year, in (at most) four
digits. | PS > "{0:yyy}" -f
[DateTime] "01/02/4567"
4567 |
yyyy
| Year, in (at most) four
digits. | PS > "{0:yyyy}" -f
[DateTime] "01/02/4567"
4567 |
yyyyy
| Year, in (at most) five
digits. | PS > "{0:yyyy}" -f
[DateTime] "01/02/4567"
04567 |
z
| Signed time zone offset from GMT.
Does not include a leading zero. | PS > "{0:%z}" -f [DateTime]::Now
-8 |
zz
| Signed time zone offset from GMT.
Includes a leading zero. | PS > "{0:zz}" -f [DateTime]::Now
-08 |
zzz
| Signed time zone offset from GMT,
measured in hours and minutes. | PS > "{0:zzz}" -f [DateTime]::Now
-08:00 |
:
| Time separator. | PS > "{0:y/m/d h:m:s}" -f
[DateTime] "01/02/4567 4:00pm"
67/0/2 4:0:0 |
/
| Date separator. | PS > "{0:y/m/d h:m:s}" -f
[DateTime] "01/02/4567 4:00pm"
67/0/2 4:0:0 |
" text "
' text '
| Inserts the provided text
literally into the output without affecting
formatting. | PS > "{0:'Day: 'dddd}" -f
[DateTime]::Now
Day: Monday |
%c
| Syntax allowing for
single-character custom formatting specifiers. The % sign is not
added to the output. | PS > "{0:%h}" -f
[DateTime] "01/02/4567 4:00pm"
4 |
Other
| Inserts the provided text
literally into the output without affecting
formatting. | PS > "{0:dddd!}" -f [DateTime]::Now
Monday! |