diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 8502f4d..1cafcdd 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -1253,7 +1253,7 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
     if (abs($timezone) > 13) {   /// Server time
         if ($fixday) {
             $datestring = strftime($formatnoday, $date);
-            $daystring  = str_replace(' 0', '', strftime(' %d', $date));
+            $daystring  = str_replace(' 0', '', strftime('%d', $date));
             $datestring = str_replace('DD', $daystring, $datestring);
         } else {
             $datestring = strftime($format, $date);
@@ -1262,7 +1262,7 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
         $date += (int)($timezone * 3600);
         if ($fixday) {
             $datestring = gmstrftime($formatnoday, $date);
-            $daystring  = str_replace(' 0', '', gmstrftime(' %d', $date));
+            $daystring  = str_replace(' 0', '', gmstrftime('%d', $date));
             $datestring = str_replace('DD', $daystring, $datestring);
         } else {
             $datestring = gmstrftime($format, $date);
