Perhaps you need a different "datestyle" setting Perhaps you need a different "datestyle" setting sql sql

Perhaps you need a different "datestyle" setting


You are using strings for the dates and are relying on session settings to interprete the strings correctly. Use supported date literals instead so as to be independent from settings.

In PostgreSQL (and the SQL standard for that matter) DATE 'YYYY-MM-DD' is considered a date literal and is the format I would recommend. So use

INSERT INTO uni_data_temp  ( sale_order_item_code  , order_date  , sale_order_item_status  , tracking_number  , dispatch_date  , user_id  ) VALUES   ( '1000932515'  , DATE '2015-05-16'  , 'DISPATCHED'  , 'UNIPAYP1958141'  , DATE '2015-05-20'  , 4  );

(Thanks to a_horse_with_no_name for pointing me to the correct date literal syntax in PostgreSQL.)

If, however, you get the dates as strings from somewhere, you need to apply the according format:

TO_DATE('06/05/2015', 'DD/MM/YYYY')TO_DATE('05/06/2015', 'MM/DD/YYYY')


In your postgresql.conf you have a setting called datestyle it is composed of two parts out and in.Might be set as iso, mdy (output as ISO and input as american) try setting it as iso, dmy

screenshot