diff --git a/clock.js b/clock.js
index 5b0cafa..4451b67 100644
--- a/clock.js
+++ b/clock.js
@@ -5,7 +5,12 @@ window.onload = startInterval;
function startInterval(){
setInterval("startTime();",1000);
}
-
+/* The function to update and format the time displayed on the page.
+ * The formating of Date() objects useing .toLocalString() is documented
+ * at the following urls:
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/DateTimeFormat
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
+ */
function startTime(){
var current_time = new Date(),
our_tz = current_time.getTimezoneOffset,
@@ -13,15 +18,27 @@ function startTime(){
+ current_time.getMinutes() + ":"
+ current_time.getSeconds();
document.getElementById('time_title').innerHTML = "Time is: "
- + formated_time.toLocaleString(
- {timeZone: current_tz},
- {dateStyle: "full"},
- {hour12: "false"})
- + " " + current_tz;
+ + current_time.toLocaleString('en-US',
+ {timeZone: current_tz,
+ hourCycle:'h24',
+ timeStyle:'long',
+ hour: '2-digit',
+ minute:'2-digit',
+ second:'2-digit',
+ timeZoneName:'short'});
//document.getElementById('time_title').innerHTML = current_tz;
- document.getElementById('time_body').innerHTML = current_time.toLocaleString(
- {timeZone: current_tz},
- {dateStyle:"long"},
- {hour12: "false"});
+ document.getElementById('time_body').innerHTML = current_time.toLocaleString('en-EN' ,{
+ timeZone: current_tz,
+ dateStyle:'long',
+ hourCycle:'h24',
+ weekday:'short',
+ month:'short',
+ day:'2-digit',
+ year:'numeric',
+ hour:'2-digit',
+ minute:'2-digit',
+ second:'2-digit',
+ timeZoneName:'short'})
+ + " " + current_time.getTimezoneOffset();
document.getElementById('JStz').innerHTML = current_tz;
}
diff --git a/clock.php b/clock.php
index b3c40ea..8917b25 100644
--- a/clock.php
+++ b/clock.php
@@ -41,7 +41,7 @@
echo "The full date and time:".
"
".
"
". - date("D M d Y H:i:s") . + 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"; @@ -52,12 +52,47 @@JS Timezone