JavaScript8 min read

JavaScript Date and Time

Master JavaScript Date object. Learn to create dates, format, calculate differences, and work with timezones.

Alex Thompson
Dec 21, 2025
5,304137

JavaScript Date and Time

Creating Dates

const now = new Date();
const specific = new Date(2025, 11, 19);
const fromString = new Date('2025-12-19');

Getting Date Parts

const date = new Date();

date.getFullYear();  // 2025
date.getMonth();     // 11 (0-11)
date.getDate();      // 19
date.getDay();       // 5 (0-6, Sunday=0)

Formatting Dates

const date = new Date();
date.toLocaleDateString(); // "12/19/2025"
date.toISOString();        // "2025-12-19T..."

Key Takeaway

Date object handles dates and times. Get parts with get methods. Format with toString methods. Essential for any app with dates.

#JavaScript#Date#Time#Beginner