I have a timecode that is in seconds, to three places past the decimal. (e.g. 10.675) I’d like to format it to read mm:ss (e.g. 00:32 or 23:04). Is there a Javascript or jQuery base function that does that? Whenever I search I only find how to add times to datepickers.
Share
Try something like the below:
This will create a new date where you can focus on the time aspect. This will not work well if you need to go over 24 hours though. For that you’d need two dates that you compare. Or just do the calculations manually using divide and modulus.
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/