Formatting Characters for Date Information

Teradata Vantage™ Data Types and Literals

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

Use the following characters in the FORMAT phrase to control formatting of date information in DATE, PERIOD(DATE), PERIOD(TIMESTAMP), and TIMESTAMP types:

Characters Meaning
MMMM

M4

Represent the month as a full month name, such as November.

Valid names are specified by LongMonths in the current SDF.

M4 is equivalent to MMMM, and is preferable to allow for a shorter, unambiguous format string.

You cannot specify M4 in a format that also has M3 or MM.

MMM

M3

Represent the month as an abbreviated month name, such as 'Apr' for April.

Valid names are specified by ShortMonths in the current SDF.

M3 is equivalent to MMM, and is preferable to allow for a shorter, unambiguous format string.

You cannot specify MMM in a format that also has MM.

MM Represent the month as two numeric digits.
DDD

D3

Represent the date as the sequential day in the year, using three numeric digits, such as '032' as February 1.

D3 is equivalent to DDD, and allows for a shorter format string.

You cannot specify DDD or D3 in a format that also has DD.

DD Represent the day of the month as two numeric digits.
YYYY

Y4

Represent the year as four numeric digits.

Y4 is equivalent to YYYY, and allows for a shorter format string.

You cannot specify YYYY or Y4 in a format that also has YY.

YY Represent the year as two numeric digits.
EEEE

E4

Represent the day of the week using the full name, such as Thursday.

Valid names are specified by LongDays in the current SDF.

E4 is equivalent to EEEE, and allows for a shorter format string.

EEE

E3

Represent the day of the week as an abbreviated name, such as 'Mon' for Monday.

Valid abbreviations are specified by ShortDays in the current SDF.

E3 is equivalent to EEE, and allows for a shorter format string.

/ Slash separator.

Copied to output string where it appears in the FORMAT phrase. This is the default separator for Teradata dates.

B

b

Blank representation separator.

Use this instead of a space to represent a blank.

, Comma separator.

Copied to output string where it appears in the FORMAT phrase.

Apostrophe separator.

Copied to output string where it appears in the FORMAT phrase.

: Colon separator.

Copied to output string where it appears in the FORMAT phrase.

  Period separator.

Copied to output string where it appears in the FORMAT phrase.

- Dash separator.

Copied to output string where it appears in the FORMAT phrase. This is the default separator for ANSI dates.

9 Decimal digit.

This formatting character can only be used with separators less than 0x009F.

The 9(n) notation can be used for more than one occurrence of this character, where n is an integer constant and means that the '9' repeats n number of times.

This formatting character is for DATE and PERIOD(DATE) types only and cannot appear as a date formatting character for PERIOD(TIMESTAMP) and TIMESTAMP types.

Z Zero-suppressed decimal digit.

This formatting character can only be used with separators less than 0x009F.

The Z(n) notation can be used for more than one occurrence of this character, where n is an integer constant and means that the 'Z' repeats n number of times.

This formatting character is for DATE and PERIOD(DATE) types only and cannot appear as a date formatting character for PERIOD(TIMESTAMP) and TIMESTAMP types.