getTime()
Returns the current time according to the computer clock. It returns an object with hours, minutes, seconds, milliseconds.
Syntax
getTime(); /* returns { h : current hour ,
m : current minute ,
s : current second ,
ms : current millisecond }
Example
setCanvas(elem);
ft=0;
function draw(){
clearCanvas();
t=getTime();
new text(100,HEIGHT/2,"Time : "+t.h+":"+t.m+":"+t.s+":"+t.ms,60,'Montserrat',500,'#fff',0,`hsl(${ft},100%,50%)`,'start');
ft++;
requestAnimationFrame(draw);
}
draw()
getTimeString()
Returns the current time according to the computer clock.
It returns a string of the form " h : m : s : ms"
Syntax
getTimeString(); // returns "h:m:s:ms"
// for example "21:38:52:274"