Bob,
I am trying to read a date input element, update it, and then save it back.
For reading the date value, I had to change the date format, before displaying it (see below.)
$form->data[date_of_birth] = date( "d/m/Y", strtotime($form->data[date_of_birth]) ) ;
I am still struggling to find a way to save this date back to the database. What is saved back into the database is (0000-00-00 00:00:00).
Debugging:
$form->data[date_of_birth] = date ("d/m/Y", strtotime($form->data[date_of_birth]) );
By the way, storing dates when creating a new database record (registration of a new user) works very smoothly. However, I am not sure what is wrong with updating dates.
Thank you for your effort and time to help...
I am trying to read a date input element, update it, and then save it back.
For reading the date value, I had to change the date format, before displaying it (see below.)
$form->data[date_of_birth] = date( "d/m/Y", strtotime($form->data[date_of_birth]) ) ;
I am still struggling to find a way to save this date back to the database. What is saved back into the database is (0000-00-00 00:00:00).
Debugging:
Array
(
[chronoform] => RegFormEdit
[event] => submit
[firstname] => Bilal
[lastname] => Abdeen
.....
[marital_status] => Single
[date_of_birth] => 04/11/2010 // The date I entered was actually 11/04/2010. Why were the day and month reversed?
)
.....
Array
(
....
[DB Save] => Array
(
[Queries] => Array
(
[0] => UPDATE `iwwaj_jsn_users` AS `SAVEjsnUser` SET `firstname` = 'Bilal', `lastname` = 'Abdeen',
...
`date_of_birth` = '11/04/2010' // This is the date I entered.
.....;
)
)
.....
)
I tried the following before submission, but it did not help.
$form->data[date_of_birth] = date ("d/m/Y", strtotime($form->data[date_of_birth]) );
By the way, storing dates when creating a new database record (registration of a new user) works very smoothly. However, I am not sure what is wrong with updating dates.
Thank you for your effort and time to help...