jQuery Clock plugin: jClock

Jquery clock plug-in can be used to show local time or some other time zone rime very easily. Websites dealing with multiple locations or having offices at multiple locations can use this feature on their websites.

You just need to include the javascript file along with jquery which is the only dependency.

 
<script src="http://plugins.jquery.com/files/jquery.jclock-1.2.0.js.txt" type="text/javascript"></script>
 


Use following code to show clock on your website

 
<script type="text/javascript">
$(function($) {
    $('.jclock').jclock();
});
</script>
 
 
<div class="jclock"></div>
 


Use following code to show clock with some styling using options object.

 
<script type="text/javascript">
$(function($) {
   var options = {
        timeNotation: '12h',
        am_pm: true,
        fontFamily: 'Verdana, Times New Roman',
        fontSize: '20px',
        foreground: 'yellow',
        background: 'red'
      }; 
   $('.jclock').jclock(options);
});
</script>
 
 
<div class="jclock"></div>
 


Show UTC time

 
<script type="text/javascript">
$(function($) {
     var options = {
        utc: true
      };
    $('.jclock').jclock(options);
});
</script>
 
 
<div class="jclock"></div>
 


Show India time (using UTC offset)

 
<script type="text/javascript">
$(function($) {
    var options={
        utc: true,
        utc_offset: 5.5
      };
    $('.jclock').jclock(options);
});
</script>
 
 
<div class="jclock"></div>
 

India Time:

Possible options: See more here

Most Commented Posts

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

[...] clock to your website is easy and you can use just javascript to create it on your web page. I have written a post on it where i used Jquery javascript library to do it. Adding better user interface for clock and [...]

[...] 7. Digital clock plugin visit [...]

Very good tutorial to learn how to create a simple digital clock with javascript, i did not know baout that jclock js plugin, but hte fact that we can configure other time zones to display, is in fact a plus, thanks for sharing.

Thank you for nice introduction and example for jClock

Waaaahhhhhhhh this is simple but impresive.

Is there any way to disable the display of seconds, as well as whether or not ‘AM/PM’ are displayed in caps or not? Thanks!

gonna use it on my website if won’t find anything better.

@Jonny

RE: “Is there any way to disable the display of seconds, as well as whether or not ‘AM/PM’ are displayed in caps or not? Thanks! “

Solution…

line 86 — var timeNow = hours + “:” + minutes; // + “:” + seconds;

this removes the seconds from the concatenation…

Cheers

oh yeah @Jonny… ” am_pm: false, “

Thanks Man.

look out one more clock plugin written in jquery, but the logic is borrowed from internet http://silibitest.unosofttech.com/jquery-clock/

I want to test the time before it is displayed to make the background change from red to green.
background: ” is empty for me at the moment.
I want it to use a jquery function to detirmine if it should be on (green) or off (red).

I wonder about opacity as well?

Anyone know the answer??

[...] reading a tweet about a clock plug-in, it made me think about how nifty it would be to have a copyright tool that could be used on sites [...]

Leave a comment

(required)

(required)