Timer format

Hello guys! I have a timer and its format just on second but I need to format It mm:ss:ms
How can I do it? Maybe someone has a reference or code template?

You’ll need some JS for this. Here’s how to make some zero padded strings and then format them

const date = new Date()
const mm = date.getMinutes().toString().padStart(2, '0')
const ss = date.getSeconds().toString().padStart(2, '0')
const ms = date.getMilliseconds().toString().padStart(4, '0')
const dateString = `${mm}:${ss}:${ms}`
1 Like