// Date and Time Functions in JS
VaR date = new date ();
Date. getyear (); // obtain the year (2 digits)
Date. getfullyear (); // obtain the complete year (4-digit, 1970 -)
Date. getmonth (); // obtain the month (0-11, 0 indicates January, so date. getmonth () + 1 is required when the current time is displayed)
Date. getdate (); // get the day (1-31)
Date. getday (); // get the week? (0-6, 0 represents Sunday)
Date. gettime (); // obtain the time in milliseconds starting from January 1)
Date. gethours (); // hours (0-23)
Date. getminutes (); // get the number of minutes (0-59)
Date. getseconds (); // obtain the number of seconds (0-59)
Date. getmilliseconds (); // obtain the number of milliseconds (0-999)
Date. tolocaledatestring (); // obtain the date
VaR time = date. tolocaletimestring (); // obtain the time
Date. tolocalestring (); // obtain the date and time