错误:日期/时间字段值超出范围:“13/01/2010”
提示:也许你需要一个不同的“数据式”设置。
我想以DD / MM / YYYY格式获取日期
SHOW datestyle; DateStyle ----------- ISO,MDY(1 row)INSERT INTO container VALUES ('13/01/2010');ERROR: date/time fIEld value out of range: "13/01/2010"HINT: Perhaps you need a different "datestyle" setting.SET datestyle = "ISO,DMY";SETINSERT INTO container VALUES ('13/01/2010');INSERT 0 1SET datestyle = default;SET
http://www.postgresql.org/docs/current/static/runtime-config-client.html#GUC-DATESTYLE
DateStyle – Sets the display format
for date and time values,as well as
the rules for interpreting ambiguous
date input values.
For historical reasons,this variable
contains two independent components:
the output format specification (ISO,
Postgres,sql,or German) and the
input/output specification for
year/month/day ordering (DMY,MDY,or
YMD).
当然最好使用明确的输入格式(ISO 8601),但根据需要进行调整是没有问题的。
总结以上是内存溢出为你收集整理的postgresql – 如何更改Postgres中的日期格式?全部内容,希望文章能够帮你解决postgresql – 如何更改Postgres中的日期格式?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)