Forum Discussion
annahino
4 years agoCommunity Member
live dynamic date and time with javascript
Just want to share here my code for a dynamic date and time - So if someone want to have the date and the time in their slide updating live, this is the code:
function dateAndTime(){ let curre...
SBP_Inc
4 years agoCommunity Member
Nice bit of code Anna. A quick suggestion for your code. Consider switching to the following Date class initializer as that gets the learner's specific (timezone adjusted) clock and formats automagically. Then currentTime is effectively ready to (for date at least). And the setTimeout for one second is unnecessary. Here's my suggested change:
let currentTime = new Date().toLocaleString('default', { year: 'numeric', month: 'long', day: 'numeric' });
For future thread viewers, Anna's code requires you have created a project variable called SystemDate...