Your Moodle version

Blocks: Simple Clock

Maintained by My mug Michael de Raadt
A simple JavaScript clock that highlights the time difference between a student and the Moodle server
Moodle 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8
  • A simple JavaScript clock
  • Highlights the time difference between a student and the Moodle server


  • Maintains time difference between page loads
  • Shows site icon and user image as clock icons


It is possible to achieve the following configurations.

  • Show server clock, user clock or both
  • Show seconds
  • Show day names
  • Show 12 or 24 hour time
  • Hide header/title
  • Hide clock icons
  • Change block title


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6
Screenshot #7


My mug
Michael de Raadt (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Chad Bergeron
    Thu, Oct 16, 2014, 4:23 AM
    I don't seem to be able to add this to the 'My Home' page (/my), only to a course page. Is that intentional?
  • My mug
    Thu, Oct 16, 2014, 8:43 AM
    Hi, Chad.

    Thanks for pointing that out. It was unintentional. I've put in a fix and will upload a new version now. See details at
  • Picture of Jason Allshorn
    Mon, Nov 24, 2014, 6:32 PM
    My Moodle Clock is an hour and a few minutes wrong. I'm about 1km from the server, but it is lagging about 1 hour and 30 seconds behind. Please can I have some ideas as to why it would be like this.
  • My mug
    Tue, Nov 25, 2014, 7:53 AM
    Hi, Jason.

    Calculating and maintaining a time difference is a complicated business. The way the Simple Clock block works is by attempting to determine the difference between your timezone and the timezone set for the server. This assumes that the server timezone and yours are set correctly in Moodle; this is what I would check. After that it only relies on computer's clock to maintain the time, in other words, to keep it ticking over. The time difference between the two times shown by default on the block should never grow.

  • Picture of Alexander Deichman
    Wed, Jul 22, 2015, 6:49 AM
    I have checked everything I thought of but I am still getting 1 hour difference between user and server time with server time being one hour less than supposed to be.
    Moodle is 2.9 and set to Toronto, php.ini is set to the same. In CLI of the server "date" returns proper parameters. The plugin is up to date. What else?
    I know that the problem is in the four lines inside the "if ($CFG->timezone!=99) {'something wrong happens here}".
    Where to look and what is the issue?
    IMPORTANT: it is an upgrade and the previous block worked perfectly fine.
    AGAIN: any help is greatly appreciated
  • Picture of Iñigo Zendegi Urzelai
    Wed, Jul 22, 2015, 6:41 PM

    I've experienced the same issue Alexander did: after upgrading to Moodle 2.9 the server time shows one hour less than it should in the block. I don't think it is related to server configuration because another instance of Moodle 2.7 on that same server shows the time like it should.

  • My mug
    Thu, Jul 23, 2015, 11:01 AM
    Thanks for reporting a problem, Guys.

    I've sent something to Alexander to test.

    Could one of you create a Tracker issue for this?

    I'm quite busy organising MootUS15 currently and any help you could provide on this issue would be welcomed.

  • Picture of Iñigo Zendegi Urzelai
    Thu, Jul 23, 2015, 6:38 PM
    I was up to create the issue but Mario has overtaken me:
  • My mug
    Fri, Jul 24, 2015, 5:59 AM
    Thanks, guys.
  • Picture of Ygor Amaral
    Fri, Sep 11, 2015, 2:28 AM
    Thanks!!! Very good!
  • My mug
    Fri, Oct 16, 2015, 10:53 AM
    I found that the new DateTimeZone object was already adjusting for daylight saving so my compensation for daylight saving was no longer necessary.

    I have created a new version that I hope will resolve this problem. Could you please test the new version (available on Git and in the here) and confirm this resolves your problem?

  • Picture of Jan Hofmann
    Fri, Oct 16, 2015, 2:21 PM
    Hi Michael,
    thanks for the update - is working for me, showing the correct time.

  • My mug
    Mon, Oct 19, 2015, 5:35 AM
    Thanks, Jan.
  • Picture of Gina Wilson
    Tue, Oct 18, 2016, 3:19 AM
    Is there any work being done on this for 3.1+? This would be a very useful block to use on our site.
    Thank you,
  • My mug
    Tue, Oct 18, 2016, 3:34 AM
    I haven't tested it yet, but it should still work. There's not too much in this block that is version specific.
1 2 3
Please login to post comments