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:
- Date basics - Creating dates, the Date object, and timestamps
- Getting date parts - Extracting year, month, day, hour, and more
- Date formatting - How to format dates for display using built-in methods and Intl.DateTimeFormat
- Date math - Adding/subtracting days, counting days between dates, getting tomorrow and yesterday
- Date comparisons - Checking if a date is today, in the past, or the same day as another date
- 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 |