Date Methods

Because you’ll often need to deal with dates, here’s a table of all of the methods of the Date object. In Table 12.1, you’ll see a reference to UTC, which stands for Coordinated Universal Time, which replaced Greenwich Mean Time (GMT) as the world standard for time in 1986. Any of the methods that contain UTC are available only in JavaScript 1.2 or later.

Table 12.1. Date Methods
MethodDescriptionReturned ValuesSupporting Browsers
getDate()The day of the month1–31JavaScript 1.0
getUTCDate()  JavaScript 1.2
getDay()The integer value of the day of the week0–6JavaScript 1.0
getUTCDay()  JavaScript 1.2
getFullYear()The full four-digit year1900+JavaScript 1.2
getUTCFullYear()   
getHours()The integer hour of the day0–23JavaScript 1.0
getUTCHours() ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.