0

I'm trying to put the last day of the actual month on an input date...

So for exemple, we are the 28 april so the default value of my input should be the 30

I'm using cakephp 2.X (I don't know which version because it's not my project)

here is my input:

<?= 
$this->Form->input('fin', array('type'  =>  'date', 'label' => "Date Validité", 'dateFormat' => 'DMY', 'separator'  => '&nbsp;', 'minYear' => '2013', 'div' => false)); 
?>

Thank you in advance and sorry for my poor english :)

Sougata Bose
  • 31,517
  • 8
  • 49
  • 87
Clément D
  • 11
  • 1
  • Thank you ! Works great: = $this->Form->input('fin', array('selected' => date("Y-m-t", strtotime($date)), 'type' => 'date', 'label' => "Date Validité", 'dateFormat' => 'DMY', 'separator' => ' ', 'minYear' => '2013', 'div' => false)); ?> – Clément D Apr 28 '15 at 12:14

1 Answers1

0

Try with date("t", strtotime(date('Y-m-d'))) -

$this->Form->input('fin', array('type'  =>  'date', 'label' => "Date Validité", 'dateFormat' => 'DMY', 'separator'  => '&nbsp;', 'minYear' => '2013', 'div' => false, value=> date("t", strtotime(date('Y-m-d')))));
Sougata Bose
  • 31,517
  • 8
  • 49
  • 87