Current date and time (long)

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 java date and time script.

Here is a tutorial that will explain the difference in between JavaScript {} and [] and gives practical examples to demonstrate both array and object concepts.

<!-- 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  -->
 
<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  -->
 
<script>
document.write("<b><font color=#ff0000 face='helvetica,arial'>" + ampmhour + "" + myminutes + ampm)
document.write(" | " + day + month);
document.write(myweekday + ", 19" + year + "</font>");
</script>
 

About The Author

M. Saqib

Saqib is Master-level IT professional with over 13 years of experience in designing and developing large scale software and web applications. He has more than six years of software and project management experience. Saqib provides consultancy to develop software systems and web services for Fortune 500 clients. He provides consultancy to develop software systems and web services for Fortune 500 clients such as Ford Motors, BMW, Hyundai and Toyota.