The date object is used to process the date and time.
Syntax for creating a date object:
VaR mydate = new date ()
The date object automatically saves the current date and time as its initial value.
The following five parameters are supported:
New date ("month DD, yyyy hh: mm: SS ");
New date ("month DD, YYYY ");
New Date (yyyy, MTH, DD, HH, mm, SS );
New Date (yyyy, MTH, DD );
New Date (MS );
Note that in the last form, the parameter represents the number of milliseconds between the creation time and the GMT time on January 1, January 1, 1970. The meanings of various functions are as follows:
Month: represents the name of a month in English, from January to December.
MTH: an integer representing the month, from (January 1, January) to 11 (January 1, December)
DD: the day of a month, from 1 to 31.
Yyyy: The Year in four-digit format.
Hh: hours, from 0 (midnight) to 23)
MM: The number of minutes, an integer from 0 to 59.
SS: number of seconds, an integer from 0 to 59
MS: Number of milliseconds, an integer greater than or equal to 0
For example:
New date ("January 12,2006 22:19:35 ");
New date ("January 12,2006 ");
New Date );
New Date (2007,0, 12 );
New Date (1137075575000 );
Date () returns the date and time of the current day.
Getdate () returns a day (1 ~ 31 ).
Getday () returns a day of a week from the date object (0 ~ 6 ).
Getmonth () returns the month from the date object (0 ~ 11 ).
Getfullyear () returns the year from the date object in four digits.
Use the getfullyear () method instead of getyear.
Gethours () returns the hour of the date object (0 ~ 23 ).
Getminutes () returns the minute of the date object (0 ~ 59 ).
Getseconds () returns the number of seconds of the date object (0 ~ 59 ).
Getmilliseconds () returns the millisecond (0 ~) of the date object ~ 999 ).
Gettime () returns the number of milliseconds since January 1, January 1, 1970.
Gettimezoneoffset () returns the minute difference between the local time and Greenwich Mean Time (GMT.
Getutcdate () returns the Day (1 ~ 31 ).
Getutcday () returns the day of the week (0 ~ 6 ).
Getutcmonth () returns the month (0 ~ 11 ).
Getutcfullyear () returns the four-digit year from the date object based on the universal time.
Getutchours () returns the hour of the date object based on the Universal Time (0 ~ 23 ).
Getutcminutes () returns the minute of the date object based on the Universal Time (0 ~ 59 ).
Getutcseconds () returns the second of the date object based on the Universal Time (0 ~ 59 ).
Getutcmilliseconds () returns the millisecond (0 ~ 999 ).
Parse () returns the number of milliseconds from midnight, January 1, January 1, 1970 to the specified date (string.
Setdate () sets a day of the month in the date object (1 ~ 31 ).
Setmonth () sets the month (0 ~) in the date object ~ 11 ).
Setfullyear () sets the year (four digits) in the date object ).
Use the setfullyear () method instead of setyear.
Sethours () sets the hour (0 ~) in the date object ~ 23 ).
Setminutes () sets the minute (0 ~ 59 ).
Setseconds () sets the second (0 ~) in the date object ~ 59 ).
Setmilliseconds () sets the millisecond (0 ~) in the date object ~ 999 ).
Settime () sets the date object in milliseconds.
Setutcdate () sets the day of the month in the date object based on the Universal Time (1 ~ 31 ).
Setutcmonth () sets the month (0 ~ 11 ).
Setutcfullyear () sets the year (four digits) in the date object based on the universal time ).
Setutchours () sets the hour (0 ~ 23 ).
Setutcminutes () sets the minute (0 ~ 59 ).
Setutcseconds () sets the second (0 ~) in the date object based on the universal time ~ 59 ).
Setutcmilliseconds () sets the millisecond (0 ~ 999 ).
Tosource () returns Source code .
Tostring () converts a date object to a string.
Totimestring () converts the time part of the date object to a string.
Todatestring () converts the date part of the date object to a string.
Use the toutcstring () method instead of togmtstring. 1 3
Toutcstring () converts a date object to a string based on the universal time.
Tolocalestring () converts a date object to a string based on the local time format.
Tolocaletimestring () converts the time part of the date object to a string based on the local time format.
Tolocaledatestring () converts the date part of the date object to a string based on the local time format.
UTC () returns the number of milliseconds from January 1, January 1, 1997 to the specified date based on the universal time.
Valueof () returns the original value of the date object.
VaR objdate = new date ([arguments list]);
The date object is used to process the date and time.
Syntax for creating a date object:
VaR mydate = new date ()
The date object automatically saves the current date and time as its initial value.
The following five parameters are supported:
New date ("month DD, yyyy hh: mm: SS ");
New date ("month DD, YYYY ");
New Date (yyyy, MTH, DD, HH, mm, SS );
New Date (yyyy, MTH, DD );
New Date (MS );
Note that in the last form, the parameter represents the number of milliseconds between the creation time and the GMT time on January 1, January 1, 1970. The meanings of various functions are as follows:
Month: represents the name of a month in English, from January to December.
MTH: an integer representing the month, from (January 1, January) to 11 (January 1, December)
DD: the day of a month, from 1 to 31.
Yyyy: The Year in four-digit format.
Hh: hours, from 0 (midnight) to 23)
MM: The number of minutes, an integer from 0 to 59.
SS: number of seconds, an integer from 0 to 59
MS: Number of milliseconds, an integer greater than or equal to 0
For example:
New date ("January 12,2006 22:19:35 ");
New date ("January 12,2006 ");
New Date );
New Date (2007,0, 12 );
New Date (1137075575000 );
Date () returns the date and time of the current day.
Getdate () returns a day (1 ~ 31 ).
Getday () returns a day of a week from the date object (0 ~ 6 ).
Getmonth () returns the month from the date object (0 ~ 11 ).
Getfullyear () returns the year from the date object in four digits.
Use the getfullyear () method instead of getyear.
Gethours () returns the hour of the date object (0 ~ 23 ).
Getminutes () returns the minute of the date object (0 ~ 59 ).
Getseconds () returns the number of seconds of the date object (0 ~ 59 ).
Getmilliseconds () returns the millisecond (0 ~) of the date object ~ 999 ).
Gettime () returns the number of milliseconds since January 1, January 1, 1970.
Gettimezoneoffset () returns the minute difference between the local time and Greenwich Mean Time (GMT.
Getutcdate () returns the Day (1 ~ 31 ).
Getutcday () returns the day of the week (0 ~ 6 ).
Getutcmonth () returns the month (0 ~ 11 ).
Getutcfullyear () returns the four-digit year from the date object based on the universal time.
Getutchours () returns the hour of the date object based on the Universal Time (0 ~ 23 ).
Getutcminutes () returns the minute of the date object based on the Universal Time (0 ~ 59 ).
Getutcseconds () returns the second of the date object based on the Universal Time (0 ~ 59 ).
Getutcmilliseconds () returns the millisecond (0 ~ 999 ).
Parse () returns the number of milliseconds from midnight, January 1, January 1, 1970 to the specified date (string.
Setdate () sets a day of the month in the date object (1 ~ 31 ).
Setmonth () sets the month (0 ~) in the date object ~ 11 ).
Setfullyear () sets the year (four digits) in the date object ).
Use the setfullyear () method instead of setyear.
Sethours () sets the hour (0 ~) in the date object ~ 23 ).
Setminutes () sets the minute (0 ~ 59 ).
Setseconds () sets the second (0 ~) in the date object ~ 59 ).
Setmilliseconds () sets the millisecond (0 ~) in the date object ~ 999 ).
Settime () sets the date object in milliseconds.
Setutcdate () sets the day of the month in the date object based on the Universal Time (1 ~ 31 ).
Setutcmonth () sets the month (0 ~ 11 ).
Setutcfullyear () sets the year (four digits) in the date object based on the universal time ).
Setutchours () sets the hour (0 ~ 23 ).
Setutcminutes () sets the minute (0 ~ 59 ).
Setutcseconds () sets the second (0 ~) in the date object based on the universal time ~ 59 ).
Setutcmilliseconds () sets the millisecond (0 ~ 999 ).
Tosource () returns the source of the object Code .
Tostring () converts a date object to a string.
Totimestring () converts the time part of the date object to a string.
Todatestring () converts the date part of the date object to a string.
Use the toutcstring () method instead of togmtstring. 1 3
Toutcstring () converts a date object to a string based on the universal time.
Tolocalestring () converts a date object to a string based on the local time format.
Tolocaletimestring () converts the time part of the date object to a string based on the local time format.
Tolocaledatestring () converts the date part of the date object to a string based on the local time format.
UTC () returns the number of milliseconds from January 1, January 1, 1997 to the specified date based on the universal time.
Valueof () returns the original value of the date object.
VaR objdate = new date ([arguments list]);