Date.UTC() vs Date.prototype.getFullYear()
Date.UTC() and Date.prototype.getFullYear() are both JavaScript Date APIs, and choosing between them is a common point of confusion. This page compares their syntax, parameters, return values, and typical use cases so you can pick the right one. Date.UTC(): Returns the timestamp from UTC parameters. Its syntax is Date.UTC(year, month, day, hour, min, sec, ms). Date.prototype.getFullYear(): Returns the year (4 digits). Its syntax is date.getFullYear(). Example of Date.UTC(): Date.UTC(2024, 0, 1) // 1704067200000. Example of Date.prototype.getFullYear(): new Date().getFullYear() // 2024. Read the full references for Date.UTC() and Date.prototype.getFullYear() to see edge cases, time complexity, browser support, and the mistakes developers most often make with each. Other Date APIs worth comparing: Date.now(), Date.parse(), Date.prototype.getMonth(), Date.prototype.getDate(), Date.prototype.getDay(), Date.prototype.getHours(). Both belong to the Date category in the JS Reference documentation, which covers 43 entries in total. Try both in the JavaScript playground to see the behavioral difference live.