javascript - This is showing 1-24 hours i need to 1-12 hours show how i can do this? -


this showing 1-24 hours need 1-12 hours show how can ?

  function onbodyload (){         var = new date();         var hr = now.gethours();         var min = now.getminutes();         var sec = now.getseconds();         document.getelementbyid('clockdisplay').innerhtml             = "time " + hr + ":" + min + ":" + sec;         settimeout('onbodyload()', 500);      } 

gethours() returns 0-23…here how convert 1-12:

var hr = time.gethours();  if (hr > 12) {     hr -= 12; } else if (hr=== 0) {    hr = 12; } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -