Welcome Guest, Not a member yet? Register   Sign In
Datepicker and inserting to DB
#2

[eluser]jonez[/eluser]
If you're getting an error on the insert (incorrect date format), format the date to match the field in your database. If it's a datetime field, do this:

Code:
'fromDate' => date( 'Y-m-d H:i:s', strtotime( $this->input->post('fromDate') ) ),

Or if it's just a date:

Code:
'fromDate' => date( 'Y-m-d', strtotime( $this->input->post('fromDate') ) ),

When you read the value back out it will be in the database format, so to turn it back into your field value use the same method and adapt the date parameters: http://php.net/manual/en/function.date.php


Messages In This Thread
Datepicker and inserting to DB - by El Forum - 11-21-2013, 03:34 AM
Datepicker and inserting to DB - by El Forum - 11-21-2013, 06:27 AM
Datepicker and inserting to DB - by El Forum - 11-21-2013, 06:32 AM
Datepicker and inserting to DB - by El Forum - 11-21-2013, 10:31 AM
Datepicker and inserting to DB - by El Forum - 11-22-2013, 05:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB