I'm attempting to make a timer for my video in AE, but when the timer gets to 10 minutes, an extra 0 is added to the front of the counter.
Any idea on how I can fix this?
sek = Math.floor(time%60);
min = Math.floor(time/60);
if(sek<10)
{
"0" + min +":0" + sek;
}
else
{
"0" + min +":" + sek;
}
There are four scenarios you should watch out for as represented below. The issue has a simple fix, trying this out should work
sek = Math.floor(time%60);
min = Math.floor(time/60);
if(min<10 && sek<10)
{
"0" + min +":0" + sek;
}
else if(min<10 && sek>=10)
{
"0" + min +":" + sek;
}
else if(min>=10 && sek<10)
{
min + ":0" + sek;
}
else if (min>=10 && sek>=10)
{
min +":" + sek;
}