Can I add a realtime date an time on my website?

Topic summary

A user seeks to display real-time date and time for their specific location (Antwerp, Belgium) on their Shopify store, similar to a reference image showing “Copenhagen” with timestamp.

Initial Solutions Provided:

  • First response offered JavaScript code using Intl.DateTimeFormat, but implementation caused header display issues
  • Code initially showed visitor’s local time rather than shop location

Working Solution:

  • Custom liquid block added to “image with text overlay” section in Prestige theme
  • JavaScript code uses Intl.DateTimeFormat with hardcoded timezone (“Europe/Copenhagen” in example)
  • Updates every 500ms to show live time

Refinements Discussed:

  • Language display follows visitor’s browser/OS preferences (showed “Mei” for Dutch, “May” for English)
  • Positioning adjustments possible via Custom CSS in section settings or Header group placement
  • Code includes fallback for older browsers (shows nothing if unsupported)

Key Technical Details:

  • Timezone can be changed to “Europe/Brussels” for Antwerp
  • Complete working code provided in final post after forum migration
  • Solution requires Custom Liquid block capability in theme
Summarized with AI on October 26. AI used: claude-sonnet-4-5-20250929.

hi!

is it possible to add a realtime date and Time on my website for my location? are there any apps or codes? like this:

site: https://www.gallerychristian.com/

thanks!

Hello @christian_russo

This is Amelia at PageFly - Shopify Advanced Page Builder app.

You can try the following steps I have provided to help you solve the problem you are facing:

Step 1: Create a section “Custom Liquid” in Customize theme
Step 2: Add code below:


Hoping my solution helps you solve your problem.

Best regards,

Amelia | PageFly

it showed the date and time but removed my header completely…how can I fix this so its just underneath my logo? and is it also possible to add Antwerp, Belgium as a location?

please let me know if this is possible

The other suggested solution shows time at visitors location, not where your shop’s located.

Since your theme, Prestige, allows you to add a “Custom liquid” block to the “image with text overlay” section, you can use the following code for this block:


See how it looks on my test store https://np98oelgehxicmvf-23104437.shopifypreview.com

Note that some older browsers may not support this code, so the code would show nothing on those browsers.

this worked but is it possible to change the date to may 14, 2024 because now it says 14 Mei 2024 which is dutch and I need it in English always. and is it also possible to place it under my header logo? thanks!

The text is actually output in your preferred language. Since your OS/browser preferred language is Dutch, it shows you “Mei”.

I intentionally did it this way.

For me it’s “May” – see the screenshot.

For visitors from US it will also show “May 14 2024” and AM/PM time…

As for placement – do you want to have this on every page of your site?

Then you may consider adding a “Custom liquid” section to the Header group and try my code there…

If only on the homepage – then may rather add this to the sections “custom CSS”:

.content { height: 100%; }

.prose {
  height:  50%;
  justify-content: space-between;
}

Where can I find this custom css section?

it’s a setting on the “image with text overlay” section.

The code which was lost during forum move is

<center><span class=ourtime>{{ 'now' | date }}</span>
</center>
<script>
  if (
    typeof Intl === "object" &&
    !!Intl &&
    typeof Intl.DateTimeFormat === "function"
  ) {
    if (!window.formatOurtime) {

      let localeOptions = new Intl.DateTimeFormat(undefined).resolvedOptions();
      localeOptions.timeZone = "Europe/Copenhagen";
      localeOptions.hour = "2-digit";
      localeOptions.minute = "2-digit";
      localeOptions.second = "numeric";
      localeOptions.timeZoneName = "short";
      localeOptions.month = "short";

      window.formatOurtime = new Intl.DateTimeFormat( undefined, localeOptions).format;
      updateElements = function () {
        let currentTime = formatOurtime( new Date());
        elements.forEach(e => { e.innerHTML = `${currentTime} - Copenhagen` });
      };

      let elements = document.querySelectorAll('.ourtime');
      if (elements.length > 0 ) {
        updateElements();
        setInterval( updateElements, 500);
      }
    }
  }
</script>