Core JavaScript 1.5 Reference:Global Objects:Date:prototype
From MDC
Contents |
[edit] Summary
Represents the prototype for the Date constructor.
[edit] Description
Date instances inherit from Date.prototype. You can modify the constructor's prototype object to affect properties and methods inherited by Date instances.
For compatibility with millennium calculations (in other words, to take into account the year 2000), you should always specify the year in full; for example, use 1998, not 98. To assist you in specifying the complete year, JavaScript includes the methods getFullYear, setFullYear, getUTCFullYear, and setUTCFullYear.
[edit] Properties
- constructor
- Returns the function that created an instance. This is the Date constructor by default.
[edit] Methods
- getDate
- Returns the day of the month for the specified date according to local time.
- getDay
- Returns the day of the week for the specified date according to local time.
- getFullYear
- Returns the year of the specified date according to local time.
- getHours
- Returns the hour in the specified date according to local time.
- getMilliseconds
- Returns the milliseconds in the specified date according to local time.
- getMinutes
- Returns the minutes in the specified date according to local time.
- getMonth
- Returns the month in the specified date according to local time.
- getSeconds
- Returns the seconds in the specified date according to local time.
- getTime
- Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC.
- getTimezoneOffset
- Returns the time-zone offset in minutes for the current locale.
- getUTCDate
- Returns the day (date) of the month in the specified date according to universal time.
- getUTCDay
- Returns the day of the week in the specified date according to universal time.
- getUTCFullYear
- Returns the year in the specified date according to universal time.
- getUTCHours
- Returns the hours in the specified date according to universal time.
- getUTCMilliseconds
- Returns the milliseconds in the specified date according to universal time.
- getUTCMinutes
- Returns the minutes in the specified date according to universal time.
- getUTCMonth
- Returns the month in the specified date according to universal time.
- getUTCSeconds
- Returns the seconds in the specified date according to universal time.
- getYear
- Deprecated
- Returns the year in the specified date according to local time. Use getFullYear instead.
- setDate
- Sets the day of the month for a specified date according to local time.
- setFullYear
- Sets the full year for a specified date according to local time.
- setHours
- Sets the hours for a specified date according to local time.
- setMilliseconds
- Sets the milliseconds for a specified date according to local time.
- setMinutes
- Sets the minutes for a specified date according to local time.
- setMonth
- Sets the month for a specified date according to local time.
- setSeconds
- Sets the seconds for a specified date according to local time.
- setTime
- Sets the
Dateobject to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.
- setUTCDate
- Sets the day of the month for a specified date according to universal time.
- setUTCFullYear
- Sets the full year for a specified date according to universal time.
- setUTCHours
- Sets the hour for a specified date according to universal time.
- setUTCMilliseconds
- Sets the milliseconds for a specified date according to universal time.
- setUTCMinutes
- Sets the minutes for a specified date according to universal time.
- setUTCMonth
- Sets the month for a specified date according to universal time.
- setUTCSeconds
- Sets the seconds for a specified date according to universal time.
- setYear
- Deprecated
- Sets the year for a specified date according to local time. Use setFullYear instead.
- toDateString
- Returns the "date" portion of the Date as a human-readable string.
- toGMTString
- Deprecated
- Converts a date to a string, using the Internet GMT conventions. Use toUTCString instead.
- toLocaleDateString
- Returns the "date" portion of the Date as a string, using the current locale's conventions.
- toLocaleFormat
- Non-standard
- Converts a date to a string, using a format string.
- toLocaleString
- Converts a date to a string, using the current locale's conventions. Overrides the Object.toLocaleString method.
- toLocaleTimeString
- Returns the "time" portion of the Date as a string, using the current locale's conventions.
- toSource
- Non-standard
- Returns a string representing the source for an equivalent
Dateobject; you can use this value to create a new object. Overrides the Object.prototype.toSource method.
- toString
- Returns a string representing the specified
Dateobject. Overrides the Object.prototype.toString method.
- toTimeString
- Returns the "time" portion of the Date as a human-readable string.
- toUTCString
- Converts a date to a string, using the universal time convention.
- valueOf
- Returns the primitive value of a
Dateobject. Overrides the Object.prototype.valueOf method.
Methods inherited from Object.prototype
__defineGetter__, __defineSetter__, hasOwnProperty, isPrototypeOf, __lookupGetter__, __lookupSetter__, __noSuchMethod__, propertyIsEnumerable, unwatch, watch