0

I have a number (e.g. 567683) that represents the amount of milliseconds a user has spent in my application. How would I format it appropriately for them? In this case, it should probably be 9 minutes and 27 seconds (assuming an English locale, something like 9 Minuten und 27 Sekunden would be appropriate for a German locale).

I've looked into the Intl API but only found timestamp formatting (like Sun Dec 11 2019) or relative time formatting (e.g. 24 minutes ago). Is there a similar API (or library) just for time amounts (for lack of a better term, English isn't my native language)? It doesn't necessarily need to be international but that would still be a plus.

leo848
  • 637
  • 2
  • 7
  • 24
  • 1
    Check this thread: [Work with a time span in Javascript](https://stackoverflow.com/questions/14297625/work-with-a-time-span-in-javascript) – n-- Oct 04 '22 at 20:52
  • Thanks, that's it. Time span is just what I was looking for and moment.js looks like a suitable library. – leo848 Oct 04 '22 at 20:53

0 Answers0