Difference between revisions of "DOM Calendar"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
<pre id='shellbody' data-qtp='clicky'></pre> | <pre id='shellbody' data-qtp='clicky'></pre> | ||
==Display | ==Display dates as specified== | ||
<div class=qu data-width=300> | <div class=qu data-width=300> | ||
* | *Show today's date, day of the week. | ||
<pre class=usr> | <pre class=usr> | ||
let | let today = new Date(); | ||
document.body.innerText = ` | |||
${today.toLocaleDateString('en',{weekday:'long'})} <br> | |||
`; | |||
</pre> | </pre> | ||
<pre class=ans> | <pre class=ans> | ||
let today = new Date(); | |||
document.body.innerText = ` | |||
${today.toLocaleDateString('en',{weekday:'long'})} <br> | |||
${today.toLocaleDateString('en',{month:'long'})} <br> | |||
${today.toLocaleDateString('fr',{weekday:'long'})} <br> | |||
${today.toLocaleDateString('fr',{month:'long'})} <br> | |||
`; | |||
</pre> | </pre> | ||
</div> | </div> |
Revision as of 21:24, 1 January 2022
Display dates as specified
- Show today's date, day of the week.
let today = new Date(); document.body.innerText = ` ${today.toLocaleDateString('en',{weekday:'long'})} <br> `;
let today = new Date(); document.body.innerText = ` ${today.toLocaleDateString('en',{weekday:'long'})} <br> ${today.toLocaleDateString('en',{month:'long'})} <br> ${today.toLocaleDateString('fr',{weekday:'long'})} <br> ${today.toLocaleDateString('fr',{month:'long'})} <br> `;