Manage and format Dates with JavaScript
Update (2025): This article was written in 2013. It still offers useful basics, but a few notes: Date.getMonth() is zero‑based (January = 0). Date.getDay() returns the weekday (0–6), not the day of month. There is no setDay() or setUTCDay() method in JavaScript. Moment.js is in maintenance mode; modern alternatives include Luxon, date‑fns, and native Intl.DateTimeFormat. Consider these for new projects. JavaScript has a Date object you can use to handle dates. Supported constructors are: ...