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

3,298 views · Published 17 January 2018 · 20:15 · Indexed 21 September 2026

Channel: All Things JavaScript, LLC · 2018 · Education

Watch on YouTube

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: 
http://www.allthingsjavascript.com

Interested in some of our courses: 
https://www.udemy.com/learn-modern-javascript-getting-started/?couponCode=YOUTUBE
https://www.udemy.com/learn-modern-javascript-advanced-topics/?couponCode=YOUTUBE

Tutorials referred to in this video:
Tracking Elapsed Time: https://youtu.be/knbUg0Q3qLU
Using Template String Literals: https://youtu.be/7M0VjaBPtyE
Determining the Number of Days Between Two Dates: https://youtu.be/uWQEGgNvac0

More from this channel