From 453a3c561f3a5ba51997364f7f4d2340e4313e10 Mon Sep 17 00:00:00 2001 From: efrick Date: Tue, 31 Mar 2020 16:54:09 -0400 Subject: [PATCH] First commit. A simple webclock written in PHP, HTML, and js. No CSS is provided. --- clock.js | 15 +++++++++++++++ clock.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 clock.js create mode 100644 clock.php diff --git a/clock.js b/clock.js new file mode 100644 index 0000000..5d7516d --- /dev/null +++ b/clock.js @@ -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(); +} diff --git a/clock.php b/clock.php new file mode 100644 index 0000000..4de8867 --- /dev/null +++ b/clock.php @@ -0,0 +1,31 @@ + + + Clock + + + + + + + +

+ Date and Time +

+
+ "; + echo "

Clock

"; + $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); + } + + ?> +

Test

+
+ +