This is the somewhat longer way to put the current date and time on your page. It writes in a longer date and time format than the previous date and time script. The script is also longer….
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | /******************************************************* * MYCPLUS Sample Code - https://www.mycplus.com * * * * This code is made available as a service to our * * visitors and is provided strictly for the * * purpose of illustration. * * * * Please direct all inquiries to saqib at mycplus.com * *******************************************************/ <!-- TWO STEPS TO INSTALL CURRENT DATE & TIME (LONG): 1. Paste the specified coding into the HEAD of your HTML document 2. Put the last code into the BODY of your HTML document --> <!-- STEP ONE: Copy this code into the HEAD of your HTML document --> <head> <script LANGUAGE="JavaScript"> <!--Total Java Scripts 99 - Next Step Software--> <!-- Begin var day=""; var month=""; var ampm=""; var ampmhour=""; var myweekday=""; var year=""; mydate = new Date(); myday = mydate.getDay(); mymonth = mydate.getMonth(); myweekday= mydate.getDate(); weekday= myweekday; myyear= mydate.getYear(); year = myyear; myhours = mydate.getHours(); ampmhour = (myhours > 12) ? myhours - 12 : myhours; ampm = (myhours >= 12) ? ' PM' : ' AM'; mytime = mydate.getMinutes(); myminutes = ((mytime < 10) ? ':0' : ':') + mytime; if(myday == 0) day = " Sunday, "; else if(myday == 1) day = " Monday, "; else if(myday == 2) day = " Tuesday, "; else if(myday == 3) day = " Wednesday, "; else if(myday == 4) day = " Thurday, "; else if(myday == 5) day = " Friday, "; else if(myday == 6) day = " Saturday, "; if(mymonth == 0) { month = "January ";} else if(mymonth ==1) month = "February "; else if(mymonth ==2) month = "March "; else if(mymonth ==3) month = "April "; else if(mymonth ==4) month = "May "; else if(mymonth ==5) month = "June "; else if(mymonth ==6) month = "July "; else if(mymonth ==7) month = "August "; else if(mymonth ==8) month = "September "; else if(mymonth ==9) month = "October "; else if(mymonth ==10) month = "November "; else if(mymonth ==11) month = "December "; // End --> </script> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <body> <center> <script> document.write("<b><font color=#ff0000 face='helvetica,arial'>" + ampmhour + "" + myminutes + ampm) document.write(" | " + day + month); document.write(myweekday + ", 19" + year + "</font>"); </script> </center> <!-- Script Size: 1.93 KB --> |