Difference between revisions of "DOM Calendar"

From ProgZoo
Jump to navigation Jump to search
Line 2: Line 2:
==Display dates as specified==
==Display dates as specified==
<div class=qu data-width=300>
<div class=qu data-width=300>
*Show today's date, day of the week.
*For today's date show
**day of the week in English
**month in English
**day of the week in French
**month in French
<pre class=usr>
<pre class=usr>
let today = new Date();
let today = new Date();

Revision as of 21:28, 1 January 2022


Display dates as specified

  • For today's date show
    • day of the week in English
    • month in English
    • day of the week in French
    • month in French
let today = new Date();
document.body.innerHTML = `
${today.toLocaleDateString('en',{weekday:'long'})} <br>
${today.toLocaleDateString('en',{weekday:'long'})} <br>
`;
let today = new Date();
document.body.innerHTML = `
${today.toLocaleDateString('en',{weekday:'long'})} <br>
${today.toLocaleDateString('en',{month:'long'})} <br>
${today.toLocaleDateString('fr',{weekday:'long'})} <br>
${today.toLocaleDateString('fr',{month:'long'})} <br>
`;