js ------ current processing time

//    the JS Get the number of days between two dates of the 
 function getDaysBetween (dateString1, dateString2) {
     var startDate = Date.parse (dateString1);
     var endDate = Date.parse (dateString2);
     var Days = (endDate - startDate) / ( * 24 * 60 *. 1 60 * 1000 );
     // Alert (Days); 
    return Days; 
} 
//    the JS get the current time is the year or month 
var myDate = new new a Date (); 
myDate.getYear ();      // get the current Year (2) 
myDate.getFullYear ();    // get the full year (4, 1970 - ????) 
myDate.getMonth ();    // get the current month (0-11,0 behalf January)
myDate.getDate ();    // Get the current day (1-31) 
myDate.getDay ();   // Get the current week X (0-6,0 for Sunday) 
myDate.getTime ();   // get the current time (from 1970.1.1 start number of milliseconds) 
myDate.getHours ();    // get the current number (0-23) hours 
myDate.getMinutes ();   // get the current number (0-59) minutes 
myDate.getSeconds ();    // obtaining the current second (0-59) 
myDate.getMilliseconds (); // get the current milliseconds (0-999) 
myDate.toLocaleDateString ();    // get the current date 
var MyTime = myDate.toLocaleTimeString ();   // get the current time 
myDate.toLocaleString ();   // get the date and time

Guess you like

Origin www.cnblogs.com/ZXH-null/p/12131413.html