Index


Here are some formats to use, for example, in Get-date -format "". These formats are focused on the .NET notation.

Date formats

Day

dThe day of the month, from 1 to 31.
Example: 9
ddThe day of the month, from 01 to 31.
Example: 09
dddThe abbreviated name of the day of the week.
Example: Mon
ddddThe full name of the day of the week.
Example: Monday

Month

MThe month, from 1 to 12.
Example: 9
MMThe month, from 01 to 12.
Example: 09
MMMThe abbreviated name of the month.
Example: Sep
MMMMThe full name of the month.
Example: September

Year

yThe year, from 0 to 99.
Example: 0900-01-01 -> 0
Example: 2024-01-01 -> 24
yyThe year, from 00 to 99.
Example: 0900-01-01 -> 00
Example: 2024-01-01 -> 24
yyyThe year, with a minimum of three digits.
Example: 0900-01-01 -> 900
Example: 2024-01-01 -> 2024
yyyyThe year as a four-digit number.
Example: 0900-01-01 -> 0900
Example: 2024-01-01 -> 2024
yyyyyThe year as a five-digit number.
Example: 0900-01-01 -> 00900
Example: 2024-01-01 -> 02024

Time Formats

Hour

hThe hour, using a 12-hour clock from 1 to 12.
Example: 1
hhThe hour, using a 12-hour clock from 01 to 12.
Example: 01
HThe hour, using a 24-hour clock from 0 to 23.
Example: 13
HHThe hour, using a 24-hour clock from 00 to 23.
Example: 13

Minute

mThe minute, from 0 to 59.
Example: 4
mmThe minute, from 00 to 59.
Example: 04

Second

sThe second, from 0 to 59.
Example: 0
ssThe second, from 00 to 59.
Example: 00

Part of a second

fThe tenths of a second in a date and time value.
Example: 2009-06-15T13:45:30.6175400 -> 6
Example: 2009-06-15T13:45:30.0000500 -> 0
ffThe hundredths of a second in a date and time value.
Example: 2009-06-15T13:45:30.6175400 -> 61
Example: 2009-06-15T13:45:30.0000500 -> 00
fffThe milliseconds in a date and time value.
Example: 2009-06-15T13:45:30.6175400 -> 617
Example: 2009-06-15T13:45:30.0000500 -> 000
ffffThe ten thousandths of a second in a date and time value.
Example: 2009-06-15T13:45:30.6175400 -> 6175
Example: 2009-06-15T13:45:30.0000500 -> 0000

AM & PM

tThe first character of the AM/PM designator.
Example: P
ttThe AM/PM designator.
Example: PM

Leave a Reply

Your email address will not be published. Required fields are marked *