From the course: Vanilla JavaScript: Web Performance Optimization APIs
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Measure time - JavaScript Tutorial
From the course: Vanilla JavaScript: Web Performance Optimization APIs
Measure time
- [Instructor] When we are working with time in JavaScript, typically we get the metrics with a timestamp. For example, if we execute new Date ().getTime, we will get a timestamp. That timestamp is expressed in a Unix format, also known as epoch. But in this case, JavaScript, instead of using the standard Unix format that is expressed in seconds, it's using milliseconds. So, it's basically the amount of milliseconds that have happened since January the 1st, 1970, at 00:00:00 UTC. Probably you are thinking, what? So if you have ever played with times in any language, probably you are used to these timestamps, or even databases, but it's a number that looks like this. In this case, this particular number can be converted into, let's say, human readable dates in our Gregorian dates, and in that case, in this case, that number is October 21st, 2015 at 7:28. So the problem is that why is this important? Because yeah, we can convert a timestamp into real date, but the importance is not…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.