Skip to content

Digital Clock with Date

Bootstrap 5 digital clock card with large glowing digits, weekday, full date, 12h/24h switch, day progress bar and time zone support.

Also known as: digital clock widget, live clock display, time and date widget, 12 hour 24 hour clock, world time clock

Bootstrap 5 Clocks Responsive Dark #card #clock #dark #date #time

Digital Clock with Date live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A large Bootstrap 5 digital clock card with the weekday, the full date, a 12h/24h switch and a day-progress bar. It works well on dashboards, kiosk screens, office displays and personal start pages.

How it works

The root is a section.dcl-clock.card with a dark navy background and amber digits. Inside the card body you find the .dcl-weekday line, a time.dcl-time element with the hours and minutes in .dcl-hm, smaller seconds in .dcl-sec and an optional AM/PM suffix in .dcl-ampm, followed by time.dcl-date. Below sit a Bootstrap .progress bar for the share of the day that has passed and a dl.dcl-meta row with the ISO week number, the day of the year and the UTC offset.

The script runs on DOMContentLoaded and initializes every .dcl-clock on the page. The render() function uses Intl.DateTimeFormat to read the current time, writes the digits, updates both datetime attributes and sets the --dcl-day custom property that controls the width of .dcl-bar. A tick() loop schedules the next update right after the start of each second, so the seconds never skip. The 12h and 24h buttons are Bootstrap .btn-check radios; their change event switches the format and re-renders immediately. The markup contains a sensible sample time, so the card still looks complete before the script runs.

Customization

  • data-dcl-timezone on .dcl-clock: add an IANA zone such as Europe/Berlin or Asia/Tokyo to show that zone; the .dcl-zone label switches to the city name automatically.
  • data-dcl-locale on .dcl-clock: change en-US to de-DE, fr-FR and so on to translate the weekday and the date.
  • data-dcl-hour12 on .dcl-clock: set it to true to start in 12-hour format with AM/PM.
  • --dcl-digit and --dcl-glow in style.css: change the digit color and its glow, for example to a green terminal look.
  • --dcl-bg and --dcl-surface: set the card background and the empty track of the progress bar.
  • --dcl-font: use another monospace face; the default loads Share Tech Mono from Google Fonts.
  • Delete the dl.dcl-meta block or the .dcl-day block for a more minimal clock; render() skips any element that is missing.

Use cases

  • Dashboards: a large glowing clock with weekday, date and day-progress bar
  • Kiosks and office displays: always-visible time that updates every second without skipping
  • Personal start pages: switch between 12-hour and 24-hour formats with one click
  • Teams across regions: show the time in another time zone such as Tokyo or Berlin
  • Multilingual sites: translate the weekday and date by changing the locale

Accessibility

The clock is a labelled section with a real heading. Time values use time elements with machine-readable datetime attributes. The seconds are hidden from screen readers with aria-hidden="true" and nothing is announced through a live region, so assistive technology is not interrupted every second. The format switch is a role="group" with an aria-label, built from native radio inputs that work with arrow keys and show a visible focus outline. The progress bar exposes aria-valuenow, aria-valuemin and aria-valuemax. Amber and light gray text on the navy background keep a high contrast ratio.

Usage notes

Requires Bootstrap 5 (added automatically), Bootstrap Icons and the Share Tech Mono font. To show several clocks, copy the section and give each copy unique id and radio name values.

Digital Clock with Date at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons, fonts.googleapis.com
Layout
Responsive, works on mobile, dark design
Category
Clocks
License
Free for personal and commercial use

Questions about this template

Can I use the Digital Clock with Date code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons and fonts.googleapis.com from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
  • <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap">
Digital Clock with Date – Bootstrap 5 clocks component screenshot
Digital Clock with Date · Bootstrap 5 Clocks

More Clocks

Live Analog Clock – Pure CSS clocks preview

Live Analog Clock

Live analog clock with CSS-rotated hands, conic-gradient ticks, a digital readout and optional time zone support, in pure CSS and vanilla JS.

World Clock Widget – Tailwind CSS clocks preview

World Clock Widget

Tailwind CSS world clock with live digital times for six cities, day and night cards, time differences, a 12h/24h switch and the Intl API.