First commit.

A simple webclock written in PHP, HTML, and js. No CSS is provided.
This commit is contained in:
efrick 2020-03-31 16:54:09 -04:00
commit 453a3c561f
2 changed files with 46 additions and 0 deletions

15
clock.js Normal file
View File

@ -0,0 +1,15 @@
window.onload = startInterval;
function startInterval(){
setInterval("startTime();",1000);
}
function startTime(){
var current_time = new Date();
var 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_test').innerHTML = current_time.getDate();
}

31
clock.php Normal file
View File

@ -0,0 +1,31 @@
<html>
<head>
<title id='time_title'>Clock</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<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"/>
<script type="text/javascript" src="clock.js"></script>
</head>
<body>
<h1>
Date and Time
</h1>
<div class="body">
<?php
$temp = "The date is ";
echo $temp . longdate(time());
echo "<br>";
echo "<p id='time_body'>Clock</p>";
$my_tz = date_timezone_get();
echo date("l M d Y H:i:s") . "$my_tz";
function longdate($timestamp)
{
return date("l F jS Y", $timestamp);
}
?>
<p id='time_test'>Test</p>
</div>
</body>
</html>