CodeIgniter Forums
How to use TO_DATE in CodeIgniter to match format in Oracle - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to use TO_DATE in CodeIgniter to match format in Oracle (/showthread.php?tid=47910)



How to use TO_DATE in CodeIgniter to match format in Oracle - El Forum - 12-28-2011

[eluser]Unknown[/eluser]
Hi guys! Here I am again, I'm really going fond of codeigniter, and I hope you can help me again with this. I'm learning through your community, and Im very thankful to all of you. Wink

So here's it. In my form, I have the deployment date field, which gets its value through a date picker beside it. I know it gets the value (for example, '12-31-2011') because it gives me this error:
Quote:A Database Error Occurred
Error Number:
Error Message:
SQL Message: INSERT INTO "PPLUS_PROJECTS" ("REFNO", "NAME", "DEPLOYMENT_DATE", "DESCRIPTION", "OWNER", "STATUS", "DEV_TYPE", "BUSINESS", "PROMO_FLAG", "PRIORITY", "PROJ_TYPE", "SYSTEM", "INVOLVEMENT", "REMARKS", "CREATED_BY") VALUES ('001', 'name', '12-31-2011', 'desc', 'ndsadona', '1', 'adhoc', 'comm', '1', '1', 'main', 'sys', 'inv', 'rem', 'ndsadona')
Filename: C:\wamp\www\projectplus\system\database\DB_driver.php
Line Number: 331

When I try to copy the sql message to an sql editor in TOAD, it gives me this error:
Quote:ORA-01843: not a valid month

In the sql editor, included this in line with the date value: ...TO_DATE('12-31-2011', 'MM-DD-YYYY')... and it worked. I just wonder how will I include that TO_DATE in my controller. :|

Any help or advice will be appreciated. Smile