JavaScript Date Object Reference

 

JavaScript Date Object Reference Chart Cheat Sheet

This is part sixteen of the JavaScript tutorial. If you missed the previous lessons, you may want to review them prior to viewing this JavaScript Date Object Reference Chart.

Locate the JavaScript code you need within the following JavaScript date object reference chart. You can then copy and paste your selected JavaScript coding into your script.

 

JavaScript Date Object Reference

Method

Description

date( )

Returns the current date and time

getDate( )

Returns the date, between the days of 1 and 31

getDay( )

Returns the day of the week, numbered 0 to 6

getMonth( )

Returns the month, numbered 0 to 11

getFullYear( )

Returns the year as a four digit number

getYear( )

Returns the year as a two digit number

getHours( )

Returns the current hour from 0 to 23

getMinutes( )

Returns the current minutes from 0 to 59

getSeconds( )

Returns the current seconds from 0 to 59

getMilliseconds( )

Returns the current milliseconds from 0 to 999

getTime( )

Returns the milliseconds since January 1, 1970

getTimezoneOffset( )

Returns the difference in time between local time and GMT

getUTCDate( )

Displays the day of the month from a Date object specified
by universal time – from 1-31

getUTCDay( )

Displays the day of the week from a Date object specified by universal
time – from 0-6

getUTCMonth( )

Displays the month from a Date object specified by universal time – from
0-6

getUTCFullYear( )

Displays the four digit year from a Date object specified by universal
time

getUTCHours( )

Displays the hour of a Date object specified by universal time – from
0-23

getUTCMinutes( )

Displays the minutes of a Date object specified by universal time – from
0-59

getUTCSeconds( )

Displays the seconds of a Date object specified by universal time – from
0-59

getUTCMilliseconds( )

Displays the milliseconds of a Date object specified by universal time
– from 0-999

parse( )

Uses a date string and displays the number of milliseconds since January
1, 1970

setDate( )

Specifies the day of the month 1-31

setMonth( )

Specifies the day of the month 0-11

setFullYear( )

Specifies the year in a Date object – four digits

setHours( )

Specifies the hour in a Date object – 0-23

setMinutes( )

Specifies the minutes in a Date object – 0-59

setSeconds( )

Specifies the seconds in a Date object – 0-59

setMilliseconds( )

Specifies the milliseconds in a Date object – 0-999

setTime( )

Figures a date and time by adding or subtracting milliseconds from January
1, 1970

setUTCDate( )

Specifies the day of the month in a Date object specified by universal
time – from 1-31

setUTCMonth( )

Specifies the month in a Date object specified by universal time – from
0-11

setUTCFullYear( )

Specifies the year in a Date object specified by universal time – four
digits

setUTCHours( )

Specifies the hour in a Date object specified by universal time – from
0-23

setUTCMinutes( )

Specifies the minutes in a Date object specified by universal time –
from 0-59

setUTCSeconds( )

Specifies the month in a Date object specified by universal time – from
0-59

setUTCMilliseconds( )

Specifies the milliseconds in a Date object specified by universal time
– from 0-999

toSource( )

Denotes the source code of an object

toString( )

Changes a Date object into a string

toUTCString( )

Changes a Date object into a string specified by universal time

toLocaleString( )

Changes a Date object into a string according to local time

UTC( )

Takes a date and returns the number of milliseconds, according to universal
time, since January 1, 1970

valueof( )

Supplies the primitive value of a Date object

 

By using a JavaScript code cheat sheet for your date objects, you can save yourself a lot of time.

 
This concludes the JavaScript Date Object Reference Chart. Congratulations on completing the JavaScript Tutorial!