0Pricing
JavaScript Academy · Lesson

Dates — Basics, Time Zones, Intl.DateTimeFormat

Create dates, read parts, format for locales, and print other time zones using Intl.DateTimeFormat.

Intro to dates

Goal: Create and format dates safely.

  • new Date()
  • Reading parts
  • Locale formatting
  • Other time zones
Dates — Basics, Time Zones, Intl.DateTimeFormat — illustration 1

Create Date values

Create with new Date(), a timestamp, or simple y/m/d parts (month index starts at 0).

// Create Date instances
// Now (current time)
const now = new Date();

// From timestamp (milliseconds since Jan 1, 1970 UTC)
const fromMs = new Date(0);

// From parts: year, monthIndex (0=Jan), day
const xmas = new Date(2025, 11, 25);

console.log("Now:", now.toString());
console.log("Epoch:", fromMs.toUTCString());
console.log("Xmas:", xmas.toDateString());
Dates — Basics, Time Zones, Intl.DateTimeFormat — illustration 2

All lessons in this course

  1. Template Literals & Common String Operations
  2. Numbers — Integers vs Floats & Math Essentials
  3. Dates — Basics, Time Zones, Intl.DateTimeFormat
← Back to JavaScript Academy