I want to display the date as DMY: example 07-07-1975
But with this code:
<?php echo h($player['Player']['player_birthDate'], array('dateFormat'=>'DMY')); ?>
I get the error message:
Warning (2): htmlspecialchars() expects parameter 4 to be boolean, array given [CORE\Cake\basics.php, line 198]
htmlspecialchars - [internal], line ??
h - CORE\Cake\basics.php, line 198
include - APP\View\Players\index.ctp, line 34
View::_evaluate() - CORE\Cake\View\View.php, line 935
View::_render() - CORE\Cake\View\View.php, line 897
View::render() - CORE\Cake\View\View.php, line 466
Controller::render() - CORE\Cake\Controller\Controller.php, line 952
Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 192
Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 160
require - APP\webroot\index.php, line 108
[main] - ROOT\index.php, line 41
Model:
'player_birthDate' => array(
'date' => array(
'rule' => array('date'),
),
),
It is easiest way to use PHP date function like
<?php echo date('d-m-Y',strtotime($player['Player']['player_birthDate'])); ?>