How best to convert CakePHP date picker form data to a PHP DateTime object?
- by Daren Thomas
I'm doing this in app/views/mymodel/add.ctp:
<?php echo $form->input('Mymodel.mydatefield'); ?>
And then, in app/controllers/mymodel_controller.php:
function add() {
# ... (if we have some submitted data)
$datestring = $this->data['Mymodel']['mydatefield']['year'] . '-' .
…