in reply to Re: Display clock
in thread Display clock
This data (assume from Server) is for testing purpose. But the Clock display will not change. Clock display as 11:22:59 PM. How can I display the running clock?function timeNow() { //Grabs the current time and formats it into hh:mm:ss am/pm fo +rmat. // now = new Date() now = new Date('Wed Sep 14 23:22:59 EDT 2005') hours = now.getHours() minutes = now.getMinutes() seconds = now.getSeconds() timeStr = "" + ((hours > 12) ? hours - 12 : hours) timeStr += ((minutes < 10) ? ":0" : ":") + minutes timeStr += ((seconds < 10) ? ":0" : ":") + seconds timeStr += (hours >= 12) ? " PM" : " AM" return timeStr }
|
|---|