Code for automatic date update

Hello,
is it possible to insert a code that updates the date in a text on my landing page?
I would need a code that updates to the current date wherever it is placed, as shown in the attached screenshot.
In the place where it says “{today’s date}”, the code should automatically insert the current date, along with the day of the week (Monday, Tuesday, etc.).
I would also need it to be in German, since the landing page is intended for the German market.
Thanks for your help.


:waving_hand: Hi @Depura, welcome to the community! :tada:

Yes, this is absolutely possible with a little bit of JavaScript. You can use a vanilla JS snippet (no extra libraries required) that finds placeholders like {today’s date} on your page and replaces them with the current date + weekday in German.

Here’s an example code you can add inside a Custom JS block:

<script>
document.addEventListener("DOMContentLoaded", function () {
  // German date formatting
  const today = new Date();
  const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
  const formattedDate = today.toLocaleDateString('de-DE', options);

  // Replace placeholders
  document.querySelectorAll("*").forEach(function (el) {
    if (el.innerHTML.includes("{today’s date}")) {
      el.innerHTML = el.innerHTML.replace("{today’s date}", formattedDate);
    }
  });
});
</script>

:white_check_mark: This will:

  • Automatically insert today’s date in German.
  • Show the day of the week (Montag, Dienstag, etc.).
  • Work anywhere you place {today’s date} inside text.

:backhand_index_pointing_right: Could you please confirm whether you want the full date with year (e.g., Montag, 18. August 2025) or just weekday + day/month (e.g., Montag, 18. August)? That way, we can fine-tune the format for your landing page.

Hi,
Thank you for the reply.
I need Weekday + day/month/year like this: Montag, 18. August 2025

Perfect :+1: snippet for that:

<script>
  document.addEventListener("DOMContentLoaded", function () {
    const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
    const today = new Date();
    const formattedDate = today.toLocaleDateString('de-DE', options);

    // Replace all occurrences of {today’s date}
    document.body.innerHTML = document.body.innerHTML.replace(/\{today’s date\}/g, formattedDate);
  });
</script>