php Postgresql 错误:日期/时间字段值超出范围
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38550020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Postgresql ERROR: date/time field value out of range
提问by
Hi i am trying to insert a date in my table. But i am getting the error. I also tried two solutions which i found:
嗨,我想在我的表中插入一个日期。但我收到错误。我还尝试了两种我发现的解决方案:
set datestyle to SQL,DMY;
set datestyle = dmy;
But the problem still exists. Please help where i am doing mistake. This is the error:
但问题仍然存在。请帮助我做错的地方。这是错误:
Error Number:
ERROR: date/time field value out of range: "24-07-2016" LINE 1: ...isalabad', E'Chief Executive ', E'1994-10-13', E'24-07-20... ^ HINT: Perhaps you need a different "datestyle" setting.
INSERT INTO "employee" ("fullname", "loginname", "email", "password", "phone", "cnic", "address", "jobdescription", "birthdate", "registered", "qualification", "lastcompany", "lastsalary", "status", "location", "department", "designation", "path") VALUES ( E'Shahzeb Akram', E'shaizi96', E'[email protected]', E'1234', E'3137688894', E'33100-8398084-5', E'Faisalabad, Faisalabad', E'Chief Executive ', E'1994-10-13', E'24-07-2016', E'BSCS', E'BOLT', E'121212', E'1', '', E'39', E'43', E'http://localhost/department/uploads/Shahzeb Akram/Screenshot_(1).png')
Filename: C:/wamp/www/department/system/database/DB_driver.php
Line Number: 691
回答by
I have to change the date format in html input tag to the Postgres date format. Thanks to @Avision for telling me how can i see the current date format used by the Postgres.
我必须将 html 输入标记中的日期格式更改为 Postgres 日期格式。感谢@Avision 告诉我如何查看 Postgres 使用的当前日期格式。
I changed it and now it is working fine :)
我改变了它,现在它工作正常:)
<input type="text" data-date-format="mm-dd-yyyy" >