1. Technology
Send to a Friend via Email

Date Method Reference

Join the Discussion

Questions? Comments?

Related Resources

Tutorial

This page lists the available methods that can be used with date objects. Entries containing UTC refer to Coordinated Universal Time (UTC).

The UTC, FullYear, and Millisecond methods were added in Javascript 1.2

Get individual date and time fields.

Retrieve information about the date and time stored in a date object.

  • getDay() integer value of day of week (0 - 6)
  • getUTCDay() integer value of day of week (0 - 6)
  • getDate() day of month
  • getUTCDate() day of month
  • getMonth() month of year (0 - 11)
  • getUTCMonth() month of year (0 - 11)
  • getFullYear() four digit year
  • getUTCFullYear() four digit year
  • getHours() hour of day (0 - 23)
  • getUTCHours() hour of day (0 - 23)
  • getMinutes() minutes into the hour
  • getUTCMinutes() minutes into the hour
  • getSeconds() seconds into the minute
  • getUTCSeconds() seconds into the minute
  • getMilliseconds() thousandths of seconds into the second
  • getUTCMilliseconds() thousandths of seconds into the second

Set individual date and time fields.

Update the date and/or time stored in a date object.

  • setDate() day of month
  • setUTCDate() day of month
  • setMonth() month of year (0 - 11)
  • setUTCMonth() month of year (0 - 11)
  • setFullYear() four digit year
  • setUTCFullYear() four digit year
  • setHours() hour of day (0 - 23)
  • setUTCHours() hour of day (0 - 23)
  • setMinutes() minutes into the hour
  • getUTCMinutes() minutes into the hour
  • setSeconds() seconds into the minute
  • setUTCSeconds() seconds into the minute
  • setMilliseconds() thousandths of seconds into the second
  • setUTCMilliseconds() thousandths of seconds into the second

Other Useful Date Methods.

  • getTime() milliseconds since midnight 1st January, 1970
  • UTC() milliseconds since midnight 1st January, 1970 UTC
  • getTimezoneOffset() minutes difference between local time and UTC
  • parse() convert a date/time string into milliseconds since midnight 1st January, 1970
  • toLocaleString() local date and time in string format
  • toString() local date and time in string format
  • toGMTString() converts a date to a string, using the Internet GMT conventions
  • toUTCString() converts a date to a string, using UTC conventions

©2014 About.com. All rights reserved.