convert from 24 to 12 hours clock script

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   convert from 24 to 12 hours clock script
Aerethorn
CZ Newbie
Aerethorn has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Jan 18, 2005
0.00 posts per day
Posts: 1
Points: 50
   
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
function getthedate()
{
   var mydate=new Date()
   var year=mydate.getYear()
   if (year < 1000)
      year+=1900
   
   var day=mydate.getDay()
   var month=mydate.getMonth()
   var daym=mydate.getDate()
   if (daym<10)
      daym="0"+daym
   
   var hours=mydate.getHours()
   var minutes=mydate.getMinutes()
   var seconds=mydate.getSeconds()
   var dn=""
   
   
   {
      d = new Date();
      Time24H = new Date();
      Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000);
      InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44);
      if (InternetTime < 10) InternetTime = "00"+InternetTime;
      else if (InternetTime < 100) InternetTime = "0"+InternetTime;
   }
   if (hours==0)
      hours=12
   if (minutes<=9)
      minutes="0"+minutes
   if (seconds<=9)
      seconds="0"+seconds
   //change font size here
   var cdate=daym+" "+montharray[month]+"  "+year+" | "+hours+":"+minutes+":"+seconds+" "+dn+""
   if (document.all)
      document.all.clock.innerHTML=cdate
   else if (document.getElementById)
      document.getElementById("clock").innerHTML=cdate
   else
      document.write(cdate)
   }

   if (!document.all&&!document.getElementById)
   getthedate()

function goforit()
{
   if (document.all||document.getElementById)
      setInterval("getthedate()",1000)
}
window.onload=goforit


I want to convert this clock from 24 hours to 12 hours.

all help is apreciated,

Aerethorn


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum