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.
Method | Description | Returned Values | Supporting Browsers |
---|---|---|---|
getDate() | The day of the month | 1–31 | JavaScript 1.0 |
getUTCDate() | JavaScript 1.2 | ||
getDay() | The integer value of the day of the week | 0–6 | JavaScript 1.0 |
getUTCDay() | JavaScript 1.2 | ||
getFullYear() | The full four-digit year | 1900+ | JavaScript 1.2 |
getUTCFullYear() | |||
getHours() | The integer hour of the day | 0–23 | JavaScript 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.