PostgreSQL日期格式错误 [英] Postgresql date format error

查看:411
本文介绍了PostgreSQL日期格式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更改日期选择器的日期格式时遇到问题。
我想使用'dd / mm / yyyy /日期格式,但是postgres抛出此错误:

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.

推荐答案

在postgreSQL数据库中设置日期样式,如下所示:

Set datestyle in your postgreSQL database as below:

SET datestyle = "ISO, DMY";

这篇关于PostgreSQL日期格式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆