This is a simple JavaScript Program to show Date and Time Stamp. With this script, you can have the date and time the page was loaded ‘stamped’ to the page. This would make a wonderful header or footer for any web page.
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 | /******************************************************* * 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 * *******************************************************/ <!-- ONE STEP TO INSTALL DATE & TIME STAMP: 1. Paste the coding into the BODY of your HTML document --> <!-- STEP ONE: Copy this code into the BODY of your HTML document --> <center> <script LANGUAGE="JavaScript"> <!-- This script and many more are available online from --> <!-- The JavaScript Source!! http://javascriptsource.com --> <!-- Begin Stamp = new Date(); document.write('<font size="2" face="Arial"><b>' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getYear() + '</b></font><br />'); var Hours; var Mins; var Time; Hours = Stamp.getHours(); if (Hours >= 12) { Time = " P.M."; } else { Time = " A.M."; } if (Hours > 12) { Hours -= 12; } if (Hours == 0) { Hours = 12; } Mins = Stamp.getMinutes(); if (Mins < 10) { Mins = "0" + Mins; } document.write('<font size="2" face="Arial"><b>' + Hours + ":" + Mins + Time + '</b></font>'); // End --> </script></center><!-- Script Size: 0.97 KB --> |