Date Object
Date object for processing dates and times.
Create a Date object syntax:
var myDate=new Date()
Notes: Date object will automatically save the current date and time of its initial value.
Date Object Properties
Attributes | description |
---|---|
constructor | Date function returns to create this object references. |
prototype | It gives you the ability to add properties and methods to an object. |
Date Object Methods
method | 描述 |
---|---|
Date() | Returns the date and time of day. |
getDate() | Returns a day (1 to 31) of the month from the Date object. |
getDay() | Date object returns a day (0-6) of the week. |
getMonth() | Returns the month (0-11) from the Date object. |
getFullYear() | From the Date object returns the year in four digits. |
getYear() | Please use getFullYear () method in place. |
getHours() | Date object hr (0 to 23). |
getMinutes() | Date object minutes (0 to 59). |
getSeconds() | Date object seconds (0 to 59). |
getMilliseconds() | Date object ms (0 to 999). |
getTime() | It returns the number of milliseconds January 1, 1970 to the present. |
getTimezoneOffset() | Returns the local time and the Greenwich Mean Time (GMT) of the difference in minutes. |
getUTCDate () | According to the world from the mid returned Date object date (1 to 31). |
getUTCDay() | Returns from the periphery of the world one day Date object according to (0-6). |
getUTCMonth() | Returns the month from a Date object according to Universal Time (0 to 11). |
getUTCFullYear() | It returns the year of a four-digit world from the Date object. |
getUTCHours() | Date object according world hr (0 to 23). |
getUTCMinutes() | Date object according world minutes (0 to 59). |
getUTCSeconds() | Date object according world seconds (0 to 59). |
getUTCMilliseconds() | Date object according world ms (0 to 999). |
parse() | Returned in January 1970 to midnight on the 1st number of milliseconds specified date (string) is. |
setDate() | Setting a day (1 ~ 31) Date object month. |
setMonth() | Month Date object set (0 to 11). |
setFullYear () | Date object in the year (four digits). |
setYear() | Please use setFullYear () method in place. |
setHours () | Setting h (0 ~ 23) Date object. |
setMinutes() | Set min (0 ~ 59) Date object. |
setSeconds() | Date object in seconds (0 to 59). |
setMilliseconds() | Provided milliseconds (0 ~ 999) Date object. |
setTime() | Date object in milliseconds. |
setUTCDate() | Set a Date object according to world day of the month (1 to 31). |
setUTCMonth() | Set the month (0 ~ 11) Date object, according to the world. |
setUTCFullYear() | Date object in the year (four digits) world according to. |
setUTCHours() | Setting h (0 ~ 23) Date object according world. |
setUTCMinutes() | Set min (0 ~ 59) Date object according world. |
setUTCSeconds() | Date object in seconds (0 to 59) in accordance with world. |
setUTCMilliseconds() | Provided milliseconds (0 ~ 999) Date object according world. |
toSource() | Back to the source code of the object. |
toString() | Date object converted to a string. |
toTimeString() | The time portion of the Date object into a string. |
toDateString() | Date the date part of the object into a string. |
toGMTString() | 请使用 toUTCString() 方法代替。 |
toUTCString() | 根据世界时,把 Date 对象转换为字符串。 |
toLocaleString() | 根据本地时间格式,把 Date 对象转换为字符串。 |
toLocaleTimeString() | 根据本地时间格式,把 Date 对象的时间部分转换为字符串。 |
toLocaleDateString() | 根据本地时间格式,把 Date 对象的日期部分转换为字符串。 |
UTC() | 根据世界时返回 1970 年 1 月 1 日 到指定日期的毫秒数。 |
valueOf() | 返回 Date 对象的原始值。 |