Forum Discussion
UCICAsociacinCi
7 months agoCommunity Member
How to show onscreen time and date in real time?
Hello,
I'm making a simulator and want to show the current date and time.
I got to make work the date, but i'm finding it difficult for the time to work.
I would appreciate some help,
Thank you
- NedimCommunity Member
Try this:
const currentTime = new Date();
const timeString = `${currentTime.getHours()}:${(currentTime.getMinutes() < 10 ? '0' : '')}${currentTime.getMinutes()}`;
setVar("HoraAhora", timeString);- UCICAsociacinCiCommunity Member
It worked! thank you very much Nedim