First commit.
A simple webclock written in PHP, HTML, and js. No CSS is provided.
This commit is contained in:
commit
453a3c561f
15
clock.js
Normal file
15
clock.js
Normal 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
31
clock.php
Normal 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>
|
Loading…
x
Reference in New Issue
Block a user