Clock Widget Generator for a Website
WM-145Choose a time zone, 12 or 24 hour time, whether to show seconds and the date, a size and colors, and copy one block of HTML that shows a live clock on any web page.
Runs in your browser. Nothing is uploaded.
How to use it
- Pick the time zone for the clock and, if you like, type a label such as New York.
- Choose 12-hour or 24-hour time, whether to show seconds, and whether to show the date.
- Choose a size and the background and text colors, with the pickers or by typing hex values.
- Check the live preview. Read any note under the settings, such as a contrast warning.
- Press Copy snippet and paste it into your page, or press Download HTML file for a whole page.
What you get
You get one block of HTML: a style element, a div and a short script. It needs no outside files, makes no network calls, sets no cookies and has no tracking. The clock shows the time in the zone you chose, with the date and seconds if you want them, and refreshes twice a second. Paste it into an HTML block or a custom code area. Some site builders strip script tags, and then the clock shows only dashes.
Time zones and daylight saving
The script asks the visitor browser, through Intl.DateTimeFormat, what time it is in your zone, so the clock follows daylight saving changes on its own and you never need to update the code. If a visitor browser does not know the zone, the clock falls back to the visitor own time zone. The time comes from the visitor device clock, so a wrong device clock shows a wrong time.
Safe text and a sandboxed preview
The optional label is escaped, so characters such as < and quotes show as plain text and cannot change the page, and it is kept out of the script. Colors must be hex values. Weekday and month names are in English. The preview runs in a sandboxed frame that can run scripts but cannot reach this page. The size changes the number height and shrinks on narrow screens.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Pick a time zone from the list. | The time zone box is empty or does not hold a zone. | Type a city or a zone name and choose it from the list. |
Colors must be hex values such as #1a2b3c or #fff. | A color box holds something other than a hex color. | Type a color like #1a2b3c, or use the color picker. |
Questions people ask
How do I add a clock to my website?
Choose the time zone and look above, press Copy snippet, and paste the code into an HTML or custom code block on your page. Save the page and the clock appears and keeps time for every visitor.
Can the clock show a different time zone from the visitor?
Yes. The clock always shows the zone you chose, whatever zone the visitor is in. Pick a city such as Tokyo or London and add a label so visitors know which place the time belongs to.
Does it change for daylight saving time?
Yes, on its own. The script reads the time from the visitor browser for your zone each time it redraws, so the clock moves with the zone rules. You do not need to paste new code when the clocks change.
Is the code free of tracking and outside files?
Yes. The snippet holds its own CSS and a short script. It does not load fonts, images or libraries, does not call any server, and does not set cookies. You can read every line in the box before you paste it.
Why does my clock show dashes?
Dashes appear when the script has not run. Some site builders and email tools remove script tags from pasted code. Look for an option such as custom HTML or embed code, or paste the snippet into a plain HTML page.
Can I show 12-hour time with AM and PM?
Yes. Choose 12-hour under Time format and the clock shows times such as 8:05 PM. Choose 24-hour for 20:05. You can also hide the seconds and the date for a smaller, simpler clock.
About this tool
The tool writes one block of HTML with inline CSS and a short script. It loads no files, calls no server, sets no cookies and has no tracking. The script asks the visitor browser, through Intl.DateTimeFormat, what time it is in the zone you picked, so the clock follows daylight saving time by itself and needs no update from you. If the visitor browser does not know the zone, the clock falls back to the visitor own time zone. It reads the visitor device clock, so a wrong device clock shows a wrong time. The optional label is escaped and kept out of the script. The clock refreshes twice a second and shows English day and month names. Colors must be hex values. The preview runs inside a sandboxed frame with scripts allowed and no access to this page. Some site builders strip script tags; the snippet then shows only dashes.