JavaScript Problem: Formatting Time Using the Date Object and String Padding

preview_player
Показать описание
In this tutorial I show you a couple of tricks that make it easier to format time in a hours, minutes, seconds pattern (0000:00:00.00). The scenario we are going to tackle is that we have collected the number of milliseconds a person as spent and now we need to format it.

For more resources on JavaScript:

Interested in some of our courses:

Tutorials referred to in this video:
Рекомендации по теме
Комментарии
Автор

Nice feature! NodeJs 8 or above supports string pad. Great to some server-side formatting. But, until the date, browsers don't. :(

tirmey
Автор

Why doesn't getHours() return the hours like the other methods please? What does it return ? Thanks

MrRossss