- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Date Components
JavaScript Dates
JavaScript Date Components
Getters read each part of a date, and setters change them.
Each part has both a local and a UTC version.
Mixing the two is a reliable source of off-by-one-day bugs.
Example
Example
javascript
const date = new Date(Date.UTC(2026, 0, 15, 14, 30, 45));
console.log(date.getUTCFullYear());
console.log(date.getUTCHours());
console.log(date.getUTCMinutes());