date format error with postgres db

qedqcd

Member
Hello,
when i try save a new line, the error comes back dbms arror 22007 date format error. I have several of my date fields set to "timestamp" on the postgres side. I am able to add new values into the database from pgadmin. Yet On the dadabik side i have it set to date_time for format. The formats look no different when entering. Any ideas?
timestamp has a length of 6
date has a length of 0 not sure why.

Thanks for your time.
MJW
 

eugenio

Administrator
Staff member
Hello,
what do you mean when you say the date has a length of 0?
Can you paste here an example of date you are trying to insert?

Best,
 

qedqcd

Member
08] Error: during query execution. INSERT INTO "collections" ("phlebassigned", "reoccuring", "pcr", "order", "facility", "lastname", "firstname", "dob", "primaryins", "primaryinsnumber", "primarygroupnumber", "secondaryins", "secondaryinsnumber", "secondarygroupnumber", "draw", "drop", "results", "upload", "provider", "company", "icd10", "tests", "sid", "notes", "trackingid", "label", "fileupload", "resultsupload") VALUES ('Alex', 'f', 't', '2020-04-09 12:00:00', 'ridge hotel', 'Smith', 'John', '1927-10-12', 'BCBS FEDERAL EMPLOYEE', '', '', '', '', '', '', '', '', '', 'Cheon, Isabel', 'Envision Physician Services LLC', '', '', '', '', '', '', '', '')
The DBMS server said: SQLSTATE[22007]: Invalid datetime format: 7 ERROR: invalid input syntax for type date: "" LINE 1: ...12', 'BCBS FEDERAL EMPLOYEE', '', '', '', '', '', '', '', ''... ^


format for DOB is set as "date", format for other date fields are set as date_time within dadabik.


format in postgres for date fields are set to "date" with length 0 and precision 13.

thanks for your help.

mjw
 

qedqcd

Member
2020-04-09 12:00:00:00 is format.

I have tried adding this format into the config.php as well as the general_function.php file.
I have tried setting default to "NULL". it is interesting that when i put no date..the field is blank, I get the same error as above. I have to think it is a php issue.

thanks for your time.

MJW
 

qedqcd

Member
So when i filled in all date values in the table, it saved with no error. All dates in the table need to be inputed for the entry to save. Interesting that the "null vlaue" check box has gone away in the main table (with the date values). But in the other support tables, the "null value" check box is still there.
 

qedqcd

Member
So updating $treat_blank_as_null = 1 in config.php made it possible to update without an error even with leaving dates blank.

my null value check boxes still aren't there under the main table, though. the other 5 tables have them.

also changing date format from "english" to yyyy_mm_dd" in config.php and general_function.php seemed to have an effect.
 

eugenio

Administrator
Staff member
Hello,
I am sorry but I don't think I have understood all the details of your scenario.
Is "1927-10-12" an example of date value that produces an error or you got an error when you tried to insert an empty date?

Is everything working now? I don't understand your last message, what did you do on general_functions.php? You don't need to change anything in general_functions.php to use dates.

Best,
 
Top