AI Workshop: learn to build apps with AI →
Dates
Working with dates and times in JavaScript using the Date object and Intl.DateTimeFormat.

Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.


Working with dates can be complicated. No matter the technology, developers do feel the pain.

JavaScript offers us a date handling functionality through a powerful built-in object: Date.

In this unit, you’ll learn:

  1. Date basics - Creating dates, the Date object, and timestamps
  2. Getting date parts - Extracting year, month, day, hour, and more
  3. Date formatting - How to format dates for display using built-in methods and Intl.DateTimeFormat
  4. Date math - Adding/subtracting days, counting days between dates, getting tomorrow and yesterday
  5. Date comparisons - Checking if a date is today, in the past, or the same day as another date
  6. Date recipes - Common patterns like sorting arrays by date, getting timestamps, and more

Lessons in this unit:

0: ▶︎ Introduction
1: Date Basics
2: Getting Date Parts
3: Date Formatting
4: Date Math
5: Date Comparisons
6: Date Recipes