Forum Discussion
ClaireBallan465
7 years agoCommunity Member
Javascript for current time and dates
Hello,
I really need some help. I want to have current dates display on columns in an elearning course that is a software simulation and I need it in different formats. Does anyone know what Javas...
ChandiJaya
4 years agoCommunity Member
Hi,
I have a Storyline3 project which needs to display the system time, always updating.
I used the following code, but it didn't work.
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
// add a zero in front of numbers<10
m = checkTime(m);
s = checkTime(s);
var p=GetPlayer();
p.SetVar("h",h);
var q=GetPlayer();
q.SetVar("m",m);
var r=GetPlayer();
r.SetVar("s",s);
var t = setTimeout(function(){ startTime() }, 1000);
}
function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
Does anyone know the exact code for this?
Chandi
Reply
Quote