开发者

Codeigniter Date format

I have se the below date format in the codeignitor config.php

$config['log_date_format'] = 'd/m/Y';

Ans wen I enter '30/04/2010' in the text input field and tr开发者_C百科ied to save, got he following error

ERROR: date/time field value out of range: "30/04/2010" HINT: Perhaps you need a different "datestyle" setting

Corresponding query is below

UPDATE "assignments" SET "id" = '2', "name" = 'Stadium complex', "date_started" = '30/04/2010', "date_completed" = NULL, "assigned_id" = '9', "customer_id" = '4', "description" = NULL WHERE "id" = '2'

How can I solve his? Do I need to format the date before save?


The 'log_date_format' setting in config.php is the date format for entries in your CodeIgniter log file. It does not have anything to do with the error you are getting.

The error is coming from your PostgreSQL database server. The date format you are trying to use in your query is not one that PostgreSQL is expecting. You can find out what date format PostgreSQL is expecting by running the command :

SHOW DATESTYLE;

You can tell PostgresSQL what date format you intend to use by executing the command

SET DATESTYLE TO '<SOME_DATESTYLE>';

More information can be found in the PostgreSQL manual.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜