Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "cn">
<Head>
<Title> positive timing </title>
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8"/>
<Style type = "text/css">
# ThenceThen {font-size: 2em ;}
</Style>
<Script type = "text/javascript" language = "javascript">
Function thenceThen (){
Var date1 = new Date (1381741113671 );
Var totalSecs = (new Date ()-data 1)/1000;
Var days = Math. floor (totalSecs/3600/24 );
Var hours = Math. floor (totalSecs-days * 24*3600)/3600 );
Var mins = Math. floor (totalSecs-days * 24*3600-hours * 3600)/60 );
Var secs = Math. floor (totalSecs-days * 24*3600-hours * 3600-mins * 60 ));
If (days! = 0 ){
Document. getElementById ("thenceThen "). innerText = "Answer time:" + days + "days" + hours + "hours" + mins + "Minutes" + secs + "seconds ";
} Else if (hours = 0 & mins = 0 ){
Document. getElementById ("thenceThen"). innerText = "Answer time:" + secs + "second ";
} Else if (hours = 0 & mins! = 0 ){
Document. getElementById ("thenceThen"). innerText = "Answer time:" + mins + "Minutes" + secs + "seconds ";
} Else if (hours! = 0 ){
Document. getElementById ("thenceThen"). innerText = "Answer time:" + hours + "Hour" + mins + "Minute" + secs + "second ";
}
}
Var clock;
Window. onload = function (){
Clock = self. setInterval ("thenceThen ()", 500 );
}
</Script>
</Head>
<Body>
<Div id = "thenceThen"> </div>
</Body>
</Html>
========================================================== ========================================================== ======================================
Var date1 = new Date (1381741113671 );
For parameter transfer, see the following section (you can also receive backend parameters ):
The following five parameters are supported:
Copy codeThe Code is as follows:
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. The parameter represents the number of milliseconds between the creation time and the GMT time of January 1, January 1, 1970. The meanings of various functions are as follows:
Month: represents the name of a month in English, from January to December.
Mth: an integer representing the month, from (January 1, January) to 11 (January 1, December)
Dd: the day of a month, from 1 to 31.
Yyyy: The Year in four-digit format.
Hh: hours, from 0 (midnight) to 23)
Mm: The number of minutes, an integer from 0 to 59.
Ss: number of seconds, an integer from 0 to 59
Ms: Number of milliseconds, an integer greater than or equal to 0
For example:
Copy codeThe Code is as follows:
New Date ("January 12,2006 22:19:35 ");
New Date ("January 12,2006 ");
New Date );
New Date (2007,0, 12 );
New Date (1137075575000 );