Specifying Individual Parts of a Custom Date Format

The following table describes the tokens that you can use to specify individual parts of a custom date format.

Token Output

d

The day of the month as a one or two digit number in the range of 1 through 31.

dd

The day of the month as a two digit number in the range of 1 through 31.

ddd

The day of the week as a three letter abbreviation in the range of Sun through Sat.

dddd

The day of the week without abbreviation in the range of Sunday through Saturday.

w

The day of the week as a number, where Sunday is 1 and Saturday is 7.

ww

The week of the year as a number in the range of 1 through 53, where the first week of January is always week 1.

m

The month of the year or the minute of the hour as a one or two digit number:

  • If the preceding token is an hour, then the minute is the output.

  • If the preceding token is not an hour, then the month is output.

mm

The month or the year or the minute of the hour as a two digit number:

  • If the preceding token is an hour, then the minute is the output.

  • If the preceding token is not an hour, then the month is output.

mmm

The month of the year as a three letter abbreviation in the range of Jan through Dec.

mmmm

The month of the year without abbreviation in the range of January through December.

q

The quarter of the year as a number in the range of 1 through 4.

y

The day of the year as a number in the range of 1 through 366.

yy

The year as a two digit number in the range of 00 through 99.

yyyy

The year as a three digit or a four digit number in the range of 100 through 9999.

h

The hour as a one digit or a two digit number in the range of 0 through 23.

hh

The hour as a two digit number in the range of 00 through 23.

n

The minute as a one digit or a two digit number in the range of 0 through 59.

nn

The minute as a two digit number in the range of 00 through 59.

s

The second as a one digit or a two digit number in the range of 0 through 59.

ss

The second as a two digit number in the range of 00 through 59.