Java Script Dates Object Date ()
1. Get the current time
var time = new Date ()
document.write (time);
Note: Returns the time of January 1, 1970 to a specified number of milliseconds if date () has parameters
When the parameter is N,q,w N represents the year Q for the month Q represents the day where the actual month will be more than the parameter month +1
2.date.now () gets the current timestamp
document.write (Date.now ()) Gets the number of milliseconds in the current time distance from January 1, 1970
var a = new Date ()
document.write (A.gettime ()); As a result
Note: document.write (time); Gets the current time Date.now () gets the current time distance of the number of milliseconds from January 1, 1970
3.date.parse () returns the number of milliseconds from January 1, 1970 to a specified time date
Console.log (Date.parse (2015,09,26,12,23,34));
Parameters: DATE.UTC () international designated date time to January 1, 1970.
4. Get the current month and day when you store it separately
Console.log (D.getfullyear ());
Console.log (D.getmonth () +1);//Get month
Console.log (D.getdate ()); Get Current day
Console.log (D.getday ());//day of the week (0 is Sunday)
Console.log (D.gethours ());
Console.log (D.getminutes ());
Console.log (D.getseconds ());
Console.log (D.getmilliseconds ());
Console.log (D.gettime ());
Java Script Dates Object Date ()