Reputation: 5742
How can I tell CakePHP to only show day, month and year and set hour, minute and second to 00 by default?
echo $this->Form->input('date', array('dateFormat' => 'DMY', 'timeFormat' => 24));
CakePHP always creates this form-input but I am not interested in hours, minutes and seconds:
Upvotes: 0
Views: 182
Reputation: 34877
The FormHelper inspects your Model's datasource (or it's cache in production) to see what type of data you're trying to store there and it creates input elements that match it.
If you're not interested in the time, try altering the field in your database table to be a DATE
field rather then a DATETIME
field. The FormHelper should then automatically drop the time fields, since they cannot be stored anyway. You may need to clear your Model cache before the change takes effect.
Upvotes: 1