![]() |
Trouble inserting date in to datetime field - 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: Trouble inserting date in to datetime field (/showthread.php?tid=32472) |
Trouble inserting date in to datetime field - El Forum - 07-24-2010 [eluser]kyleect[/eluser] I'm having trouble inserting the date from a form field in to the datetime field of my table. The code below takes any date string from the form and inserts it as '0000-00-00 00:00:00'. The `date` field is listed as a datetime field in MySQL. Can someone see something I'm overlooking for why this doesn't work? Thanks! Model methods from MY_Model: Code: protected function convert_date_to_sqldate($date) Code on page: Code: $insert_data = array( Trouble inserting date in to datetime field - El Forum - 07-24-2010 [eluser]Georgi Budinov[/eluser] Perhaps your problem is here ![]() Code: protected function convert_date_to_sqldate($date) to Code: protected function convert_date_to_sqldate($date) Check this http://php.net/manual/en/function.date.php Trouble inserting date in to datetime field - El Forum - 07-24-2010 [eluser]kyleect[/eluser] I changed i to s because the manual said i was minutes. It worked! Thanks. |