How to Check the Current datestyle Setting in PostgreSQL

PostgreSQL has a datestyle setting that specifies the display format for date and time values, as well as the rules for interpreting ambiguous date input values. 

We can check the current value of our datestyle setting by running SHOW datestyle.

Example

Here’s an example to demonstrate:

SHOW datestyle;

Result:

 DateStyle 
-----------
ISO, MDY

This shows that my current datestyle variable is set to ISO, MDY, which is the default value.

The value of the datestyle variable contains two separate components: the output format specification (ISOPostgres, SQL, or German) and the input/output specification for year/month/day ordering (DMY, MDY, or YMD). These can be set separately or together.

Euro and European are synonyms for DMY, while US, NonEuro, and NonEuropean are synonyms for MDY.

As mentioned, the default value is ISO, MDY, but initdb will initialise the configuration file with a setting that corresponds to the behaviour of the chosen lc_time locale.