function updateClock ( ) { var currentTime = new Date ( ); var currentHours = currentTime.getHours ( ); var currentMinutes = currentTime.getMinutes ( ); // Pad the minutes and seconds with leading zeros, if required currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes; // Choose either "AM" or "PM" as appropriate var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"; // Convert the hours component to 12-hour format if needed currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours; // Convert an hours component of "0" to "12" currentHours = ( currentHours == 0 ) ? 12 : currentHours; // Compose the string for display var currentTimeString = currentHours + ":" + currentMinutes + " " + timeOfDay; $("#time").html(currentTimeString); } $(document).ready(function(){ var lock = new PatternLock("#patternContainer"); lock.checkForPattern("321478965", function() { window.location.href = "index.html"; }); setInterval('updateClock()', 1000); var objToday = new Date(), weekday = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'), dayOfWeek = weekday[objToday.getDay()], dayOfMonth = objToday.getDate(), months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), curMonth = months[objToday.getMonth()], curYear = objToday.getFullYear(); var today = dayOfWeek + "
" + curMonth + " " + dayOfMonth + ", " + curYear; $("#date").html(today); });