Reputation: 1099
I'm having problems when changing the date format for the datepicker. I want to have the 'dd/mm/yyyy/ date format but postgres throws me this error:
ActiveRecord::StatementInvalid - PG::DatetimeFieldOverflow: ERROR: date/time field value out of range: "16/07/2014"
Perhaps you need a different "datestyle" setting.
because of its american way of saving the date format.
Upvotes: 0
Views: 4582
Reputation: 656331
The datestyle
setting defines a default for your system. Consider @Ilesh's answer. The setting in postgresql.conf applies to all databases in the db cluster.
To make statements work without regard to the setting, use the to_date()
function to form date values from string constants:
SELECT to_date('16/07/2014', 'DD/MM/YYYY');
Related:
Store date with optional month / day
Upvotes: 4
Reputation: 2155
Set datestyle in your postgreSQL database as below:
SET datestyle = "ISO, DMY";
Upvotes: 4