Dates and times run our daily lives. JavaScript has a built-in Date object which allows you to track and show the date and time in the user’s current time zone. This guide brings together tutorials that will teach you how to work with dates and times in JavaScript.
JavaScript From Scratch
Envato Tuts+ has some wonderful free courses to help you brush up on the basics of JavaScript or learn them from scratch.
These tutorials will give you an in-depth knowledge of working with JavaScript dates.
The best way to learn is by doing. Follow along by using the real-world examples in the tutorials.
1. How to Work With Time Zones in JavaScript
A time zone is any region of the Earth with the same standard time. In this tutorial, you will learn all about time zones and how to work with time zones in JavaScript.
2. How to Get and Set the Day, Month, Year, or Time in JavaScript
In this tutorial, Monty Shokeen shows you how to use the built-in methods of the Date
object to get and set the day, month, year, or time in JavaScript.
3. How to Add or Subtract Days (And More) From Dates in Vanilla JavaScript
The focus of this tutorial will be on learning how to add or subtract a period of time such as years, months, days, hours, and minutes from a specified date.
4. How to Change the Date Format in JavaScript
In this article, we’ll see how you can change the format of a date in JavaScript. We’ll go through a couple of real-world examples to demonstrate how you can convert a date from one format to another in JavaScript.
5. How to Add and Subtract Time From a Date in JavaScript
In this article, we’ll discuss how you can do date manipulations with a JavaScript Date
object. Specifically, we’ll see how you can add time to a Date
object and subtract time from a Date
object in JavaScript.
6. Best JavaScript Date and Time Libraries
This tutorial will give you a brief overview of some of the best and most popular free date and time libraries in JavaScript.
7. Using Luxon for Date and Time in JavaScript
Luxon is an incredibly powerful library for working with dates and times in JavaScript. In this tutorial, you will learn how to use the Luxon library in your projects.