HTML Digital Clock for website

Description

  • HTML and Javascript code to create a digital clock on your website that will always display the current time on a page. Each digit for the clock is image based.

Steps

  1. Save the number images and stick them in the same directory as the page. (you can also download a zip file of everything)
  2. Copy and Paste the Source Code into your HTML page.
  3. You are welcome to use your own images for this. Just be sure the image names are the same as the ones used here.
  4. For those of you looking for more, there is also 24 Hour Version and a Time Zone offset version (change the tzOffset variable), and a date version (date version can be combined with a time version).




Source Code


Numbers to save: (or zip of files)

Comments

Thanks!

Hello! I was having the roughest time trying to find free digital-looking numbers, and was ecstatic when I finally found this site. Would you happen to be able to upload (or send to me) bigger images though? I need images around 48 X 72 pixels. Either way, I appreciate it.

Digital Numbers

Answer

I personally don't have any other digit images. But as long as the images have the same file names (eg; "dg8.gif" for the "8"), any images can be used.

Coding for 30 minute time different timezones

Tried to create a timezone that is not an hour different but 30 mins different. Any help with code please

Thanks Danny

Answer

You need to add the following line to make the clock 30 mins ahead:
d.setMinutes(d.getMinutes() + 30);If you want the time to be exactly 30 mins from whatever the local time is, add it right under
d = new Date();

if you're changing the "Time Zone offset version" you should add it right under this instead:
d.setHours(d.getHours() + tzOffset);

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.