As a function, a Date object can be called directly, returning a string of the current date and time.
Date () //"Sat 12:46:54 gmt+0800 (CST)"
Date (1, 1) //"Sat Mar 12:46:54 gmt+0800 (CST)"
var today = new Date (); Get current time (yyyy/yyyy-mm/yyyy-mm-dd/thh:mm (e.g. "t12:00")/thh:mm:ss/ THH:mm:ss.sss )
Date method
today. GetTime (): Returns the number of milliseconds that the instance object corresponds to 00:00:00 January 1, 1970, equivalent to the ValueOf method.
today. GetDate (): Returns the number of each month that the instance object corresponds to (starting at 1).
today. GetDay (): Returns the week, Sunday is 0, Monday is 1, and so on.
today. getFullYear (): Returns the four-bit year.
today. GetMonth (): Returns the month (0 = January, 11 for December).
today. GetHours (): Returns the hour (0-23).
today. Getmilliseconds (): Returns milliseconds (0-999).
today. getminutes (): Returns the minute (0-59).
today. getseconds (): Returns seconds (0-59).
today. getTimezoneOffset (): Returns the time zone difference between the current time and UTC, expressed in minutes, and the return result takes into account the daylight savings factor.
The Data () object in JS