Book Contents

Book Index

Next Topic

Home

DATESTYLE

The SET DATESTYLE command changes the DATESTYLE run-time parameter for the current session.

Syntax

SET DATESTYLE TO { value | 'value' } [ ,... ]

Semantics

The DATESTYLE parameter can have multiple, non-conflicting values:

 

Value

Interpretation

Example

MDY

month-day-year

12/17/1997

DMY

day-month-year

17/12/1997

YMD

year-month-day

1997-12-17

ISO

ISO 8601/SQL standard (default)

1997-12-17 07:37:16-08

SQL

traditional style

12/17/1997 07:37:16.00 PST

POSTGRES

original style

Wed Dec 17 07:37:16 1997 PST

GERMAN

regional style

17.12.1997 07:37:16.00 PST

In the SQL and POSTGRES styles, day appears before month if DMY field ordering has been specified, otherwise month appears before day. (See Date/Time Constants for how this setting also affects interpretation of input values.) The table below shows an example.

 

DATESTYLE

Input Ordering

Example Output

SQL, DMY

day/month/year

17/12/1997 15:37:16.00 CET

SQL, MDY

month/day/year

12/17/1997 07:37:16.00 PST

Postgres, DMY

day/month/year

Wed 17 Dec 07:37:16 1997 PST

Notes

Example

SET DATESTYLE TO POSTGRES, MDY;