I am writing a small application with clock that sicplay date and time with tenths of a second. What is the most efficient to do this ?
I have already wrote this but I doubt that this is a good solution :
var today=new Date();
var mini=today.getMilliseconds();
mini = mini %1000;
if(mini < 100) mini = 0;
else{
mini = ""+mini;
mini = mini.substring(0,1);
}
Try this:
BTW
mini % 1000is redundant, milliseconds never exceed 1000.