diff --git a/course/modedit.php b/course/modedit.php
index c1dcbaa..c216feb 100644
--- a/course/modedit.php
+++ b/course/modedit.php
@@ -345,12 +345,6 @@
             if (!empty($CFG->enableavailability)) {
                 $cm->availablefrom             = $fromform->availablefrom;
                 $cm->availableuntil            = $fromform->availableuntil;
-                // The form time is midnight, but because we want it to be
-                // inclusive, set it to 23:59:59 on that day.
-                if ($cm->availableuntil) {
-                    $cm->availableuntil = strtotime('23:59:59',
-                        $cm->availableuntil);
-                }
                 $cm->showavailability          = $fromform->showavailability;
                 condition_info::update_cm_from_form($cm,$fromform,true);
             }
@@ -416,12 +410,6 @@
             if(!empty($CFG->enableavailability)) {
                 $newcm->availablefrom             = $fromform->availablefrom;
                 $newcm->availableuntil            = $fromform->availableuntil;
-                // The form time is midnight, but because we want it to be
-                // inclusive, set it to 23:59:59 on that day.
-                if ($newcm->availableuntil) {
-                    $newcm->availableuntil = strtotime('23:59:59',
-                        $newcm->availableuntil);
-                }
                 $newcm->showavailability          = $fromform->showavailability;
             }
 
diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php
index a2dae5d..eec36fa 100644
--- a/course/moodleform_mod.php
+++ b/course/moodleform_mod.php
@@ -373,9 +373,9 @@ abstract class moodleform_mod extends moodleform {
         if (!empty($CFG->enableavailability)) {
             // Conditional availability
             $mform->addElement('header', '', get_string('availabilityconditions', 'condition'));
-            $mform->addElement('date_selector', 'availablefrom', get_string('availablefrom', 'condition'), array('optional'=>true));
+            $mform->addElement('date_time_selector', 'availablefrom', get_string('availablefrom', 'condition'), array('optional'=>true));
             $mform->setHelpButton('availablefrom', array('conditiondates', get_string('help_conditiondates', 'condition'), 'condition'));
-            $mform->addElement('date_selector', 'availableuntil', get_string('availableuntil', 'condition'), array('optional'=>true));
+            $mform->addElement('date_time_selector', 'availableuntil', get_string('availableuntil', 'condition'), array('optional'=>true));
             $mform->setHelpButton('availableuntil', array('conditiondates', get_string('help_conditiondates', 'condition'), 'condition'));
 
             // Conditions based on grades
