13.2.2 Date Values

Date values use only one specifier. This specifier uses combinations of three key letters (d,m,y) to control the formatting. The table below shows how the key letters are used.

String Description

d One or two digit day of month (blank fill).

dd Two digit day of month (zero fill).

ddd Three letter abbreviation of day of week.

dddd Full name of day of week.

m One or two digit month (blank fill).

mm Two digit month (zero fill).

mmm Three letter abbreviation of month.

mmmm Full name of month.

y Not valid (use \y or y)

yy Two digit year (zero fill).

yyy Not valid (use \y\y\y for yyy)

yyyy Four digit year.

When the date value is converted, these key letters are replaced with the described values. All other characters are inserted as literal text. The examples below show the result of formatting a date value of January 2, 1986.

Format Result

mm/dd/yy 01/02/86

d-mmm-yyyy 2-Jan-1986

ddd, d mmmm yyyy Thu, 2 January 1986

To\da\y is: dd-mm-yy Today is: 02-01-86

dddd Thursday

Note the use of the escape character (\) to insert the key letters (d and y) into the formatted text. As the last example shows, it is not required that a format show all of a date. However, such formats can't be used for input and should be avoided as system formats.