Added a CSS file to allow proper formatting of the date and time line.

This commit is contained in:
20xd6 2020-04-11 13:15:37 -04:00
parent ed4652ace1
commit c7a0849ef5
3 changed files with 8 additions and 12 deletions

3
clock.css Normal file
View File

@ -0,0 +1,3 @@
span p{
display:inline;
}

View File

@ -13,10 +13,7 @@ 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();
our_tz = current_time.getTimezoneOffset;
document.getElementById('time_title').innerHTML = "Time is: "
+ current_time.toLocaleString('en-US',
{timeZone: current_tz,
@ -26,7 +23,6 @@ function startTime(){
minute:'2-digit',
second:'2-digit',
timeZoneName:'short'});
//document.getElementById('time_title').innerHTML = current_tz;
document.getElementById('time_body').innerHTML = current_time.toLocaleString('en-EN' ,{
timeZone: current_tz,
dateStyle:'long',
@ -38,7 +34,6 @@ function startTime(){
hour:'2-digit',
minute:'2-digit',
second:'2-digit',
timeZoneName:'short'})
+ " " + current_time.getTimezoneOffset();
timeZoneName:'short'});
document.getElementById('JStz').innerHTML = current_tz;
}

View File

@ -14,7 +14,6 @@
}
} else{
$selectedTimezone = date_default_timezone_get();
//date_default_timezone_set("America/Los_Angeles");
$scriptTZ = date_default_timezone_get();
}
?>
@ -29,6 +28,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="author" content="efrick"/>
<link href="/styles.css" type="text/css" rel="stylesheet"/>
<link href="clock.css" type="text/css" rel="stylesheet"/>
<script>var current_tz=<?php echo json_encode($scriptTZ);?></script>
<script type="text/javascript" src="clock.js"></script>
</head>
@ -39,12 +39,10 @@
<div class="body">
<?php //Print default time and date values for the JS to update.
echo "The full date and time:".
"<br>".
"<br><span>".
"<p id='time_body'>".
date("D, M d, Y, H:i:s") .
" GMT" . date("O") . " (" . date("T") . ")"."</p>\n\t\t";
echo '<p>The user timezone is now set to ' . $selectedTimezone . "</p>\n\t\t";
echo '<p>The system timezone is now set to ' . $scriptTZ . "</p>\n";
date(" T")."</p><p> GMT". date("O") ."</p>\n\t\t</span>";
?>
<div class="tz_select">
<p>