diff --git a/clock.css b/clock.css index 18d440c..0d85a54 100644 --- a/clock.css +++ b/clock.css @@ -4,3 +4,6 @@ span p{ select { max-width: 95%; } +.chkbox { + display: inline-block; +} diff --git a/clock.js b/clock.js index 2b6c2c5..98cc7eb 100644 --- a/clock.js +++ b/clock.js @@ -34,7 +34,7 @@ function startTime(){ hour:'2-digit', minute:'2-digit', second:'2-digit',}); - if(original_tz != null){ + if(original_tz){//Test if there is a non-null value for original_tz. If True then the part of the page this pertains to is being displayed. document.getElementById('time_original').innerHTML = current_time.toLocaleString('en-EN' ,{ timeZone: original_tz, dateStyle:'long', @@ -47,5 +47,5 @@ function startTime(){ minute:'2-digit', second:'2-digit'}); } - document.getElementById('JStz').innerHTML = current_tz; + //document.getElementById('JStz').innerHTML = current_tz; } diff --git a/clock.php b/clock.php index 1bd394b..4ef3c76 100644 --- a/clock.php +++ b/clock.php @@ -9,8 +9,10 @@ if(!isset($selectedTimezone)){ //I don't have any error message set here. It will just reload the page. } else{ + $origHour = date('O'); $originalTZ = date_default_timezone_get(); date_default_timezone_set($selectedTimezone); + $scriptHour = date('O'); $scriptTZ = date_default_timezone_get(); } } else{ @@ -52,6 +54,10 @@ "
GMT". date("O T") .'
'; date_default_timezone_set($scriptTZ); } + if($_POST['displayOffset']){ + $tzDifferance = (-1 * ($origHour - $scriptHour)) * 0.01; + echo 'The difference between the timezones is ' . $tzDifferance . ' hours
'; + } ?>
@@ -103,6 +109,10 @@
+ Display offset of selected timezones
+
+