Set the Default Date on the Moodle Date Picker


You can set the default date on the Moodle Date Picker using the setDefault method for example:

$mform->setDefault('date_field', date('U', strtotime("+14 days")));

The following code changes the default value of the date picker from today’s date to 14 days in the future. The second parameter returns the date in Unix format 14 days from now.


Revision #1
Created Sun, Jul 21, 2019 11:04 PM by Moodle Wiki
Updated Sun, Jul 21, 2019 11:05 PM by Moodle Wiki