Dynamic Weekday

</ head>

</ body>

<!-- DYNAMIC WEEKDAY --> 
<script>
  // for each .weekday element
  document.querySelectorAll('.weekday').forEach(weekday => {
    // get today's day
    const today = new Intl.DateTimeFormat('en', {weekday:'long'}).format(new Date());
    // set it as the current text
    weekday.textContent = today;
  });
</script>

HTML/Embed

Only tabs with a " " have code.
<!-- DYNAMIC WEEKDAY --> 
<script>
  // for each .weekday element
  document.querySelectorAll('.weekday').forEach(weekday => {
    // get today's day
    const today = new Intl.DateTimeFormat('en', {weekday:'long'}).format(new Date());
    // set it as the current text
    weekday.textContent = today;
  });
</script>
Only tabs with a " " have code.
Only tabs with a " " have code.
Only tabs with a " " have code.
If you have already pasted this code into your project then you can skip this. If you haven't, and it's your first time using CodeCrumbs, then copy this code and navigate to your sites global settings > Custom Code tab > paste it into the <head> (first custom code block). It just needs to exist once.
Author
Traf
Updated on
May 8, 2024

How to use:

Unlock more with PRO

Want to learn how to use this Crumb? Unlock detailed documentation, video tutorials, comments & support!

Upgrade to Pro

Unlock more with PRO

Want to learn how to use this Crumb? Unlock detailed documentation, video tutorials, comments & support!

Upgrade to Pro
Tutorial Coming Soon!

Check Browser Support

Interactive Table

This snippet will generate the text dynamically for the correct weekday where ever you want in your project.

Clone Project
Documentation
Author:
Status:
Deprecated
New
Updated
Latest Version:
Built by
Built with
For the best experience

Please switch to desktop to view the content.

Back Home
Thank you! Your submission has been received!
Close Form
Oops! Something went wrong while submitting the form.
Become a Contributor