Time Selector

Time Selector

by Akshat Chaurasiya -
Number of replies: 0

How to take input time in dynamic form in moodle

I have a plugin with dynamic form. and I want take input Time (like as Start time) in my form.

please tell me how to take time .

the code is ....

for ($i = 0; $i <= 23; $i++) {

            $hours[$i] =  sprintf("%02d", $i) ;

        }

        for ($i = 0; $i <= 59; $i++) {

            $minutes[$i] ="   " .  sprintf("%02d", $i);

        }


        $stime=array();

        $stime[]=& $mform->createElement('select', 'minutes', '', $minutes);

        $stime[]=& $mform->createElement('select', 'hours', '', $hours);

        $mform->addGroup($stime,'stime',' start time' ,' ',false);

        $mform->addRule('stime', get_string('stimeerr', 'local_program'), 'required', null);




in print_r($row);

die;


and output is .......

-------------------------------------------------

Array

(

    [name] => xyz

    [code] => abc1

    [image] => 135252711

    [sdate] => 1658880000

    [stime] => 

    [edate] => 1658880000

    [duration] => 900

    [description] => test description

)


Average of ratings: -