Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
/*** Clock -- beginning of server-side support code
by Andrew Shearer, http://www.shearersoftware.com/
v2.1.2-PHP, 2003-08-07. For updates and explanations, see
<http://www.shearersoftware.com/software/web-tools/clock/>. ***/
/* Prevent this page from being cached (though some browsers still
cache the page anyway, which is why we use cookies). This is
only important if the cookie is deleted while the page is still
cached (and for ancient browsers that don't know about Cache-Control).
If that's not an issue, you may be able to get away with
"Cache-Control: private" instead. */
header("Pragma: no-cache");
/* Grab the current server time. */
$gDate = time();
/* Are the seconds shown by default? When changing this, also change the
JavaScript client code's definition of clockShowsSeconds below to match. */
$gClockShowsSeconds = false;
function getServerDateItems($inDate) {
return date('Y,n,j,G,',$inDate).intval(date('i',$inDate)).','.intval(date('s',$inDate));
// year (4-digit),month,day,hours (0-23),minutes,seconds
// use intval to strip leading zero from minutes and seconds
// so JavaScript won't try to interpret them in octal
// (use intval instead of ltrim, which translates '00' to '')
}
function clockDateString($inDate) {
return date('l, F j, Y',$inDate); // eg "Monday, January 1, 2002"
}
function clockTimeString($inDate, $showSeconds) {
return date($showSeconds ? 'g:i:s' : 'g:i',$inDate).' ';
}
/*** Clock -- end of server-side support code ***/
?>
<html>
<head>
<title>Clock</title>
<meta name="template" content="none">
<script language="JavaScript" type="text/javascript">
</script>
<script language="JavaScript1.2" type="text/javascript">
</script>
</head>
<body bgcolor="#FFFFFF"
onload="clockInit(clockLocalStartTime, clockServerStartTime);clockOnLoad();"
onunload="clockOnUnload()">
<div id="ClockTime" style="position: absolute; left: 406px; top: 28px;
width: 200px; height: 20px; z-index: 11; cursor: pointer"
onclick="clockToggleSeconds()">
<p><?php echo(clockTimeString($gDate,$gClockShowsSeconds));?></p>
</div>
<div id="ClockBkgnd" style="position: absolute; left: 406px; top: 28px;
width: 200px; z-index: 10">
<p> <br>
<?php echo(clockDateString($gDate));?></p>
</div>
<p><i>Click on the time to show or hide seconds.</i></p>
</body>
</html>