function updateClock(){ var offsetHours = 5; var systemDate = new Date(); var utcOffset = systemDate.getTimezoneOffset() / 60; var utc = systemDate.getTime(); offsetHours += utcOffset; var date = new Date(utc + ( 3600000 * offsetHours ) ); var year = date.getFullYear(); var month = date.getMonth(); var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'Jully', 'August', 'September', 'October', 'November', 'December'); var d = date.getDate(); var day = date.getDay(); var days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); var amPM = (hours > 11) ? "PM" : "AM"; if ( hours > 12 ) { hours -= 12; } else if(hours == 0) { hours = "12"; } if ( hours < 10 ) { hours = "0" + hours; } if ( minutes < 10 ) { minutes = "0" + minutes; } if ( seconds < 10 ){ seconds = "0" + seconds; } var result = days[day]+', '+months[month]+' '+d+', '+year+' '+hours+':'+minutes+':'+seconds+' '+amPM; $("#clock").text(result); }
setInterval(updateClock, 1000);
Loading Info...