JS new Date () Get time
The Date object is used to process dates and times.
To create the syntax for a Date object:
var mydate=new Date ()
The Date object automatically saves the current date and time as its initial value.
There are 5 parameters in the form of:
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 the last form, which represents the number of milliseconds between the time to create and the GMT time of January 1, 1970. The meanings of the various functions are as follows:
Month: The name of the months in English, from January to December
MTH: The month is represented by an integer, from (January) to 11 (December)
DD: Represents the day ordinal of one months, from 1 to 31
YYYY: four-digit year
HH: Hours, from 0 (midnight) to 23 (11 o'clock in the evening)
MM: Number of minutes, integers from 0 to 59
SS: Number of seconds, integers from 0 to 59
MS: Number of milliseconds, integer greater than or equal to 0
Such as:
New Date ("January 12,2006 22:19:35");
New Date ("January 12,2006");
New Date (2006,0,12,22,19,35);
New Date (2006,0,12);
New Date (1137075575000);
Date () Returns the day and time.
GetDate () Returns the day of the one month (1 ~ 31) from the Date object.
GetDay () Returns the day of the week (0 ~ 6) from the Date object.
GetMonth () returns the month (0 ~ 11) from the Date object.
getFullYear () returns the year as a four-digit number from a Date object.
GetYear () Please use the getFullYear () method instead.
GetHours () returns the hour (0 ~ 23) of the Date object.
Getminutes () returns the minute (0 ~ 59) of the Date object.
Getseconds () returns the number of seconds (0 ~ 59) of the Date object.
Getmilliseconds () returns the milliseconds (0 ~ 999) of the Date object.
GetTime () returns the number of milliseconds since January 1, 1970.
getTimezoneOffset () returns the minute difference between local time and Greenwich Mean Time (GMT).
getUTCDate () Returns the day of the month (1 ~ 31) from the Date object according to the world.
GetUTCDay () Returns the day of the week (0 ~ 6) from the Date object according to the world.
getUTCMonth () returns the month (0 ~ 11) from the Date object, depending on the world.
getUTCFullYear () returns a four-digit year from a Date object according to the world.
getUTCHours () returns the hour (0 ~ 23) of the Date object according to the universal.
getUTCMinutes () returns the minute (0 ~ 59) of the date object according to the universal.
getUTCSeconds () returns the second (0 ~ 59) of the Date object according to the universal.
getUTCMilliseconds () returns the milliseconds (0 ~ 999) of a Date object based on the universal.
Parse () returns the number of milliseconds from midnight January 1, 1970 to the specified date (string).
SetDate () Sets the day of the month in the Date object (1 ~ 31).
Setmonth () sets the month (0 ~ 11) in the Date object.
setFullYear () sets the year (four digits) in the Date object.
Setyear () Please use the setFullYear () method instead.
Sethours () sets the hour (0 ~ 23) in the Date object.
Setminutes () sets the minute (0 ~ 59) in the Date object.
Setseconds () sets the second (0 ~ 59) in the Date object.
Setmilliseconds () sets the milliseconds (0 ~ 999) in the Date object.
SetTime () Sets the Date object in milliseconds.
SetUTCDate () Sets the day of the month in the Date object according to the world time (1 ~ 31).
setUTCMonth () sets the month (0 ~ 11) in the Date object according to the world time.
setUTCFullYear () sets the year (four digits) in the Date object according to the world time.
setUTCHours () sets the hour (0 ~ 23) in the Date object according to the world time.
setUTCMinutes () sets the minute (0 ~ 59) in the Date object according to the world time.
setUTCSeconds () sets the seconds (0 ~ 59) in the Date object according to the world time.
setUTCMilliseconds () sets the milliseconds (0 ~ 999) in the Date object according to the world time.
Tosource () returns the source code of the object.
ToString () Converts the Date object to a string.
toTimeString () Converts the time portion of a Date object to a string.
toDateString () Converts the date part of a Date object to a string.
toGMTString () Please use the toutcstring () method instead. 1 3
toUTCString () Converts the Date object to a string based on the universal.
toLocaleString () Converts a Date object to a string based on the local time format.
toLocaleTimeString () Converts the time portion of a Date object to a string, based on the local time format.
toLocaleDateString () Converts the date part of a Date object to a string, based on the local time format.
UTC () returns the number of milliseconds from January 1, 1997 to the specified date, depending on the time.
ValueOf () returns the original value of the Date object.
var objdate=new Date ([arguments list]);
JS new Date () Get time