#MoodleTip – Changing course start date at bulk

September 29th, 2015

Every year all the Moodle administrators has to recycle their courses and do a lot of things to cleanup the courses, which we are covering time to time on our previous posts. One other things which Moodle administrators has to encounter is to change the Course start date to a new date for all the courses on the Moodle site.

Recently I stumbled upon one small MySQL query mentioned in a forum thread, so I thought to share with all my beloved readers.

If you are using phpMyAdmin, or similar, you can generate a Query UPDATE statement that will update all the courses start date to the required date – all you need do is find the right table. For example,  open one course and set the start date to the right start date. Go to the mdl_courses table and find that course. Copy the start date in its format and the write a Update statement that reads something like:

UPDATE `moodledb`.`mdl_course` SET `startdate` = 1443510356 WHERE `mdl_course`.`id` = *;

Changing course start date in bulk

You can specify the course ID in place of ‘*’ to change the dates for specific courses. In order to change the date for all course, all you need to do is to just remove the WHERE clause in the above statement like:

UPDATE `moodledb`.`mdl_course` SET `startdate` = 1443510356

The startdate above is 29 September 2015, but you can reset it for anything through this link which is a Epoch Unix Time Stamp Converter.

You can also share more tips like these by filling out this form. Do let us know if this tip is of any help to you.

Reference: https://moodle.org/mod/forum/discuss.php?d=318364