Date instance is initiated with the Date() constructor:
var myDate = new Date();
| METHOD | DESCRIPTION |
|---|---|
| toDateString() | Returns day of the week, month, day of the month and year. |
| toTimeString() | Returns hours, minutes, seconds and time zone. |
| toLocaleDateString() | Returns day of the week, month, day of the month and year in locale format. |
| toLocaleTimeString() | Returns hours, minutes, seconds and time zone in locale format. |
| toUTCString() | Returns the UTC date. |
| METHOD | DESCRIPTION |
|---|---|
| Date.parse() | Default conversion method. Returns milliseconds of the given date. |
| Date.UTC() | Returns milliseconds of the given date. Difference from Date.parse() methods is that here arguments are provide as numbers (year, month, day, hour, min, sec, msec) |
| getTime() | Returns the milliseconds representation of the date (same as valueOf()) |
| setTime(milliseconds) | Sets the milliseconds representation of the date. |
| getFullYear() | Returns the four digit year. |
| getUTCFullYear() | Returns the four digit year in UTC format. |
| setFullYear(year) | Sets the four digit year of the date. |
| setUTCFullYear(year) | Sets the four digit year in UTC format. |
| getMonth() | Returns the month of the date (0 = January, 11 = December). |
| getUTCMonth() | Returns the month in UTC format (0 = January, 11 = December). |
| setMonth(month) | Sets the month of the date (0 ? 11). If the number is larger then 11, the year also increases. |
| setUTCMonth(month) | Sets the month of the date in UTC format (0 ? 11). If the number is larger then 11, the year also increases. |
| getDate() | Returns the day of the month (1 through 31). |
| getUTCDate() | Returns the day of the month in UTC format (1 through 31). |
| setDate(date) | Sets the day of the month for the date. If the number is greater than maximum for that month, the month also increases. |
| setUTCDate(date) | Sets the day of the month for the date in UTC format. If the number is greater than maximum for that month, the month also increases. |
| getDay() | Returns the day of the week (0 = Sunday, 6 = Saturday). |
| getUTCDay() | Returns the day of the week in UTC format (0 = Sunday, 6 = Saturday). |
| getHours() | Returns the hours of the day (0 ? 23). |
| getUTCHours() | Returns the hours of the day in UTC format (0 ? 23). |
| setHours(hours) | Sets the hours of the day (0 -23). Setting numbers larger than 23 may increase the day as well. |
| setUTCHours(hours) | Sets the hours of the day in UTC format (0 -23). Setting numbers larger than 23 may increase the day as well. |
| getMinutes() | Returns the minutes of the hour (0 ? 59). |
| getUTCMinutes() | Returns the minutes of the hour in UTC format (0 ? 59). |
| setMinutes(minutes) | Sets the minutes of the hour (0 ? 59). If the number is larger then 59, the hour increases. |
| setUTCMinutes(minutes) | Sets the minutes of the hour in UTC format (0 ? 59). If the number is larger then 59, the hour increases. |
| setUTCMinutes(minutes) | Sets the minutes of the hour in UTC format (0 ? 59). If the number is larger then 59, the hour increases. |
| getSeconds() | Returns the seconds of the minute (0 ? 59). |
| getUTCSeconds() | Returns the seconds of the minute in UTC format (0 ? 59). |
| setSeconds(seconds) | Sets the date's seconds (0 ? 59). If the number is larger than 59, the minute increases. |
| setUTCSeconds(seconds) | Sets the date's seconds in UTC format (0 ? 59). If the number is larger than 59, the minute increases. |
| getMilliseconds() | Returns the current milliseconds. |
| getUTCMilliseconds() | Returns the current milliseconds in UTC format. |
| setMilliseconds(milliseconds) | Sets the current date's milliseconds. |
| setUTCMilliseconds(milliseconds) | Sets the current date's milliseconds in UTC format. |
| getTimezoneOffset() | Returns the number of minutes that the local time zone is offset with (5 hours = 300 minutes). |
Comments
No comments have been made yet.
Please login to leave a comment. Login now