how do I display in a cakephp form value from orm in date format

50 Views Asked by At

I have the below code in a cakephp templage

 echo $this->Form->input('Applicant.application_date',array('between'=>$star,))

the value from the database is a date type and the form displays it as a series of dropdown for the month date and year how do i make it display as a date picker or just an input box with values in the format DD/MM/YYYY

1

There are 1 best solutions below

0
dype On

To display a datepicker, you can add a piece of javascript.

Here is a sample with jquery :

Template:

$this->Form->control("horaire",[
            'value'=>$horaire
            ]);

Javascript part:

$("#horaire").datetimepicker({
        dateFormat : "dd/mm/yy",
        timeFormat: 'HH:mm',
        hourGrid : 4,
        minuteGrid : 10,
        stepMinute: 5,
        hour : 20,
        minute : 0
    });