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 - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -