TIMESTAMP_FORMAT option

Function

Sets the format used for timestamps retrieved from the database.

Allowed values

A string composed of the symbols listed below.

Default

'YYYY-MM-DD HH:NN:SS.SSS'

Description

The format is a string using these symbols:

Table 2-19: TIMESTAMP_FORMAT string symbols

Symbol

Description

yy

2-digit year.

yyyy

4-digit year.

mm

2-digit month, or two digit minutes if following a colon (as in 'hh:mm').

mmm

3-character short form for name of the month of year

mmmm[m...]

Character long form for month name—as many characters as there are m's, until the number of m’s specified exceeds the number of characters in the month’s name.

dd

2-digit day of month.

ddd

3-character short form for name of the day of week.

dddd[d...]

Character long form for day name—as many characters as there are d's, until the number of d’s specified exceeds the number of characters in the day’s name.

hh

2-digit hours.

nn

2-digit minutes.

ss.SSS

Seconds (ss) and fractions of a second (SSS), up to six decimal places. Not all platforms support timestamps to a precision of six places.

aa

a.m. or p.m. (12-hour clock).

pp

p.m. if needed (12-hour clock.)

Each symbol is substituted with the appropriate data for the date being formatted. Any format symbol that represents character rather than digit output can be in uppercase, which causes the substituted characters also to be in uppercase. For numbers, using mixed case in the format string suppresses leading zeros.

Multibyte characters are not supported in format strings. Only single-byte characters are allowed, even when the collation order of the database is a multibyte collation order like 932JPN.

See also

“DATE_FORMAT option”

“RETURN_DATE_TIME_AS_STRING option”