Website HTML Javascript Clock (Date and Time)

Description

  • This generator allows you to create the Javascript code necessary to put a text clock on your website that can display the current time (and date). The clock keeps updating in real time. Multiple time and date formats to choose from.

Steps

  1. Select how you want your clock/calendar to look
  2. Generate the HTML and JavaScript code for your clock (button at bottom)
  3. Preview your clock at the bottom above the code
  4. Copy and Paste the Source Code into your HTML page

Note

  • If you want to change the size, font, or color you can edit the last line of your generated code and add a style="" property like: <div id="clockbox" style="font:14pt Arial; color:#FF0000;"></div>


Text Clock Format


Source Code
loading clock preview...

Comments

Combining two scripts

When I use the Clock Friday January 6, 2012 10:33:33 A.M. I would like to display
Today is Friday January 6, 2012 10:33:33 A.M.
Combining the Clock with the Countdown stops the countdown since I call the Clock following the Countdown. I suspect it has something to do with the call to onload
Thank You
I was able to implement your solution to use the include but I now realize why it failed when I tried it
(I have a script that uses onload elsewhere).
Just to clarify I did not copy the two scripts into a single file.

Ideally I should be able to have a single script that delivers both functions instead of having to use two
seperate scripts, one of which steps on the other, but this may be asking too much.

Answer

If you are combining it with the countdown, you can combine the onload events into the single function from the countdown:

window.onload=function(){
GetCount(dateFuture1, 'countbox1'); // for the countdown
GetClock();// for the clock
}

Comment viewing options

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