Web based solutions, tutorials, examples and help. 

  • Header Time

 #15  by Nito
 Wed Jul 21, 2010 8:25 am
Migrated from old Database.
Original Author: TheKiwi
--
Got bored today so I removed some of the stuff that isn't needed :)

Code: Select allfunction addTime()
{
   var dtObj = new Date();
   var title = document.title;
   var mins = dtObj.getMinutes();
   var hrs = dtObj.getHours();
   var ampm;
   
   if(mins <= 9)
   mins = "0" + mins;
   if(hrs > 11)
   ampm = "PM";
   else
   ampm = "AM";
   document.title = title + " " + "TIME: " + hrs + ":" + mins + ampm;
}