472084
472084

Reputation: 17885

saving cakephp date fields

I have a form that includes an hour and minute drop down using this: 'dateFormat'=>'NONE', 'timeFormat'=>'24' But now when i save the form $this->data ends up looking like the array below and because eventStartDate & eventStartDate are arrays it makes an SQL error saying eventStartDate can not be null etc.

Array
(
    [Work] => Array
        (
            [eventStartDate] => Array
                (
                    [hour] => 12
                    [min] => 00
                )

            [eventEndDate] => Array
                (
                    [hour] => 12
                    [min] => 45
                )

            [description] => 234
            [projectID] => 7105
            [taskID] => 1
            [userid] => 8
        )

)

Upvotes: 0

Views: 1185

Answers (1)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

This might help, as it worked for me: Your view code should look something like this

echo $form->dateTime('your_column_name', 'NONE', '24'); 

Upvotes: 4

Related Questions