Skip to content
Advertisement

vanilla js – How would i display a video.currentTime value in a minutes:seconds

I’m trying to get my website to return its video.currentTime value in a minutes:seconds way

For example, this is what I need: 00:10

But I am getting: 10.04

Code:

JavaScript

Advertisement

Answer

video.currentTime outputs the video time in seconds.

You can just convert it to minutes and seconds.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement