diff --git a/clock.js b/clock.js index 0613d78..5b0cafa 100644 --- a/clock.js +++ b/clock.js @@ -1,4 +1,6 @@ - +/*Clock functionality. When the page is loaded it starts a one second + * long loop to update the time displayed on the page. + */ window.onload = startInterval; function startInterval(){ setInterval("startTime();",1000); @@ -6,9 +8,20 @@ function startInterval(){ function startTime(){ var current_time = new Date(), + our_tz = current_time.getTimezoneOffset, formated_time = current_time.getHours() + ":" + current_time.getMinutes() + ":" + current_time.getSeconds(); - document.getElementById('time_title').innerHTML = "Time is: " + formated_time; - document.getElementById('time_body').innerHTML = Date(); + document.getElementById('time_title').innerHTML = "Time is: " + + formated_time.toLocaleString( + {timeZone: current_tz}, + {dateStyle: "full"}, + {hour12: "false"}) + + " " + current_tz; + //document.getElementById('time_title').innerHTML = current_tz; + document.getElementById('time_body').innerHTML = current_time.toLocaleString( + {timeZone: current_tz}, + {dateStyle:"long"}, + {hour12: "false"}); + document.getElementById('JStz').innerHTML = current_tz; } diff --git a/clock.php b/clock.php index 3613970..b3c40ea 100644 --- a/clock.php +++ b/clock.php @@ -1,28 +1,66 @@ + + -
-". - date("D M d Y H:i:s") . - " GMT" . date("O") . " (" . date("T") . ")"."
"; - ?> -". + date("D M d Y H:i:s") . + " GMT" . date("O") . " (" . date("T") . ")"."
\n\t\t"; + echo 'The user timezone is now set to ' . $selectedTimezone . "
\n\t\t"; + echo 'The system timezone is now set to ' . $scriptTZ . "
\n"; + ?> ++ If the detcted timezone is not correct selct your timezone from the dropdown below. +
+JS Timezone
+