Support Forums
my basic clock in php - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: my basic clock in php (/showthread.php?tid=4871)



my basic clock in php - ELY_M - 02-17-2010

Demo:
http://bmx3r.com/clock/clock.php

Images:
http://bmx3r.com/clock/
you have to grab images or use your own numbers.

Php code:

PHP Code:
$hours date("h");
$minutes date("i");
$seconds date("s");
$ampm date("a");
$hours1substr("$hours"01);
$hours2 substr("$hours"11);
$minutes1 substr("$minutes"01);
$minutes2 substr("$minutes"11);
$seconds1 substr("$seconds"01);
$seconds2 substr("$seconds"11);
/* AM or PM */
if($ampm == "am")
{
$time_ampm "am.gif";
}
else
{
$time_ampm "pm.gif";
}

/* hours*/
print "<img src=\"$hours1.gif\"><img src=\"$hours2.gif\"><img src=\"colon.gif\">";

/* minutes */
print "<img src=\"$minutes1.gif\"><img src=\"$minutes2.gif\"><img src=\"colon.gif\">";

/* seconds and AM or PM */
print "<img src=\"$seconds1.gif\"><img src=\"$seconds2.gif\"><img src=\"$time_ampm\">"