JavaScript has a built in function that allows you to work with dates. This feature is great for creating a calender, to display the current date, or to create a clock. You can also use the date function to set the date in your script.
| Date Objects | ||
|---|---|---|
| Method | Description | |
| getDate() | Returns the current date and time | |
| getFullYear() | Returns the four digit year | |
| getYear() | Returns the year in two digit format, ie 08 | |
| getUTCFullYear | Returns the four digit year according to universal time. | |
| getUTCYear | Returns the year in two digit format according to universal time | |
| getMonth | Returns the month as a number, between 0 and 11 | |
| getUTCMonth | Returns the month as a number according to universal time | |
| getDate | Returns the day of the month. | |
| getUTCDate | Returns the day of the month according to universal time | |
| getDay() | Returns the day of the week as a number between 0-6 | |
| getUTCDay() | Returns the day of the week according to universal time | |
| Time Objects | |
|---|---|
| Method | Description |
| getHour() | Returns the hour in 24-hour format |
| getUTCHour() | Returns the hour according to universal time in 24 hour format |
| getMinute() | Returns the minute between 0 and 59 |
| getUTCMinute() | Returns the minute according to universal time |
| getSecond() | Returns the second between 0 and 59 |
| getUTCSecond() | Returns the second according to universal time |
| getMillisecond() | Returns the millisecond between 0 and 999 |
| getUTCMillisecond() | Returns the millisecond according to universal time |
| getTimezoneOffset() | Returns the difference in minutes between GMT and local time |



