JavaScript Date Methods – Full Reference

Working with dates and times in JavaScript can seem a bit tricky at first. Luckily, JavaScript provides a powerful built-in object called Date, which comes with lots of methods to get and set date and time values.

In this post, we’ll go over the most useful Date methods in a simple and easy-to-understand way. We'll divide them into three parts:

  1. Get Methods – to retrieve date and time information
  2. Set Methods – to update or change the date and time
  3. Conversion Methods – to convert date objects to strings

 Get Methods – Read Date and Time

MethodWhat It Does
getDate()Gets the day of the month (1–31).
getDay()Gets the day of the week (0–6, where 0 = Sunday).
getFullYear()Gets the full year (like 2025).
getHours()Gets the hour (0–23).
getMilliseconds()Gets the milliseconds (0–999).
getMinutes()Gets the minutes (0–59).
getMonth()Gets the month (0–11, where 0 = January).
getSeconds()Gets the seconds (0–59).
getTime()Gets milliseconds since Jan 1, 1970.
getTimezoneOffset()Gets the time zone difference from UTC in minutes.
getUTCDate()Gets the day of the month using UTC.
getUTCDay()Gets the day of the week using UTC.
getUTCFullYear()Gets the year using UTC.
getUTCHours()Gets the hour using UTC.
getUTCMilliseconds()Gets the milliseconds using UTC.
getUTCMinutes()Gets the minutes using UTC.
getUTCMonth()Gets the month using UTC.
getUTCSeconds()Gets the seconds using UTC.
getYear()Deprecated – returns year minus 1900.

Set Methods – Update the Date

MethodWhat It Does
setDate()Sets the day of the month.
setFullYear()Sets the full year, optionally month and date.
setHours()Sets the hour, optionally minutes/seconds/milliseconds.
setMilliseconds()Sets the milliseconds.
setMinutes()Sets the minutes, optionally seconds and milliseconds.
setMonth()Sets the month, optionally the day.
setSeconds()Sets the seconds, optionally the milliseconds.
setTime()Sets the time in milliseconds since Jan 1, 1970.
setUTCDate()Sets the day using UTC.
setUTCFullYear()Sets the year using UTC.
setUTCHours()Sets the hour using UTC.
setUTCMilliseconds()Sets the milliseconds using UTC.
setUTCMinutes()Sets the minutes using UTC.
setUTCMonth()Sets the month using UTC.
setUTCSeconds()Sets the seconds using UTC.
setYear()Deprecated – avoid using this method.

 Convert Date to String

MethodWhat It Does
toDateString()Shows only the date part (e.g., "Fri May 17 2025").
toGMTString()Returns a date string in GMT format.
toLocaleDateString()Shows the date in your local format.
toLocaleFormat()Returns a date string in default format.
toLocaleString()Shows the full date and time in local format.
toLocaleTimeString()Shows only the time in your local format.
toString()Converts the date to a readable string.
toTimeString()Shows only the time part.
toUTCString()Shows the date and time in UTC format.
valueOf()Returns the primitive numeric value (same as getTime()).

 Note: 

Always remember: Months are zero-based in JavaScript. That means January is 0, February is 1, and so on.

Also, avoid using deprecated methods like getYear() and setYear(). Use getFullYear() and setFullYear() instead.