Tsallaka zuwa abun ciki
Justice Tech School

Working with Dates

Create dates with new Date(). Use getFullYear, getMonth (0 based), getDate and toISOString. Do date maths with timestamps and prefer UTC for storing.

Example
const d = new Date("2026-03-15T10:30:00Z");
console.log(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
console.log(d.toISOString());
const later = new Date(d.getTime() + 7 * 24 * 3600 * 1000);
console.log(later.toISOString().slice(0, 10));

Exercise

Month numbers start at.

getMonth() starts at 

Quiz Test

What is getMonth() for March?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.