Version compl�te: jsB@nk » Heure » Horloge » Pourtant, une autre date et heure d'affichage
URL: https://www.javascriptbank.com/yet-another-date-and-time-display.html
Afficher la date courante, heure et le jour de la semaine dans vos pages Web.
Version compl�te: jsB@nk » Heure » Horloge » Pourtant, une autre date et heure d'affichage
URL: https://www.javascriptbank.com/yet-another-date-and-time-display.html
<SCRIPT language=JavaScript><!-- Activate Cloaking Device// Global variables for timer.var timerID = null;var timerRunning = false;function startclock () { // Make sure the clock is stopped stopclock(); time(); }function stopclock () { if(timerRunning) clearTimeout(timerID); timerRunning = false; }function time () { var now = new Date(); var yr = now.getYear(); var mName = now.getMonth() + 1; var dName = now.getDay() + 1; var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate(); var ampm = (now.getHours() >= 12) ? " P.M." : " A.M." var hours = now.getHours(); hours = ((hours > 12) ? hours - 12 : hours); var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes(); var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds(); if(dName==1) Day = "Sunday"; if(dName==2) Day = "Monday"; if(dName==3) Day = "Tuesday"; if(dName==4) Day = "Wednesday"; if(dName==5) Day = "Thursday"; if(dName==6) Day = "Friday"; if(dName==7) Day = "Saturday"; if(mName==1) Month="January"; if(mName==2) Month="February"; if(mName==3) Month="March"; if(mName==4) Month="April"; if(mName==5) Month="May"; if(mName==6) Month="June"; if(mName==7) Month="July"; if(mName==8) Month="August"; if(mName==9) Month="September"; if(mName==10) Month="October"; if(mName==11) Month="November"; if(mName==12) Month="December"; // String to display current date. var DayOfWeek =(" " + Day + " "); // Displays the current time. document.forms[0].elements[0].value = DayOfWeek; // String to display month, day, & year. var MonthDayYear =(" " + Month + " " + dayNr + ", " + yr + " "); // Displays the month, day, & year. document.forms[0].elements[1].value = MonthDayYear; // String to display current time. var TimeValue =(" " + hours + minutes + seconds + " " + ampm); // Displays the current time. document.forms[0].elements[2].value = TimeValue; timerID = setTimeout("time()",1000); timerRunning = true; }// Deactivate Cloaking --></SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<BODY onload="startclock()"><FORM><TABLE width=500 border=3> <TBODY> <TR> <TD align=middle><FONT color=#800000 size=+1><STRONG>Day of the Week</STRONG></FONT></TD> <TD align=middle><INPUT size=13 value=Weekday name=local></TD></TR> <TR> <TD align=middle><FONT color=#800000 size=+1><STRONG>Month, Day, and Year</STRONG></FONT></TD> <TD align=middle><INPUT size=22 value="Month, Day, and Year" name=local></TD></TR> <TR> <TD align=middle><FONT color=#800000 size=+1><STRONG>Current Time</STRONG></FONT></TD> <TD align=middle><INPUT size=16 value="Current Time" name=local></TD></TR></TBODY></TABLE><BR><TABLE width=400 border=0> <TBODY> <TR> <TD align=middle><INPUT onclick=stopclock() type=button value=Pause></TD> <TD align=middle><INPUT onclick=startclock() type=button value=Resume></TD> <TD align=middle><INPUT type=reset value=Reset></TD></TR></TBODY></TABLE></FORM></BODY><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->