|
|
|
The following is simply a cool way to show a date.
Cut/paste as you neeed, but the code will run "as-is"
I have used the css ID "mydate" to position the date
display as needed. Move as you may.
To see a working example, please review:
http://www.xn--ovg.com/kewl_date
tedd
--- copy below "as-is" ----
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>Stuff by tedd</title>
<style type="text/css">
#mydate
{
position: absolute;
top: 10em;
left: 10em;
}
table.date
{
font-size: small; /*1em; */
font-family: verdana, arial, helvetica, sans-serif;
margin:auto;
}
table.date th
{
font-weight:normal;
text-align:center;
}
table.date th.day
{
padding-right:0.5em;
}
table.date th.month
{
padding:0.5em;
}
table.date td
{
vertical-align:top;
text-align:center;
background:#CAD6E2;
padding:0.4em;
}
</style>
</head>
<body>
<h1>tedd's kewl date</h1>
<?php
$date = date('Y\-\ m\-\ d');
$date = str_replace(" ", "", $date);
echo("Date: " . $date. "<br/>" );
?>
<div id="mydate">
<table class="date" cellspacing="2" cellpadding="0">
<tr>
<th></th>
<?php
for ($i = 1; $i <= 12; $i++)
{
echo("<th class=\"month\">" . date("M", mktime(0, 0, 0, $i+1, 0, 0 )));
}
?>
</tr>
<tr>
<th class="day">
<?php
echo(date('Y') . "</th>");
for ($i = 1; $i <= 12; $i++)
{
echo("<td>");
if(date('m') == $i)
{
echo(date('j'));
}
echo("</td>");
}
?>
</tr>
</table>
</div>
</body>
</html> | | |
|
| Simple PHP control CSS Calendar Categories : PHP, HTML and PHP, Calendar, Date Time, CSS | | | Change the background color of a website daily dynamically using the php date function to get the current day of the week and depending on that day, set the background color for the web page. Categories : PHP, Date Time, Beginner Guides, Web Design | | | Website colour changer Categories : PHP, HTML and PHP, Date Time | | | PHP Calendar Categories : PHP, Calendar, Date Time, Java Script, CSS | | | This script contains 2 functions: 1 to create html select object based on your own customer date format entry- "M d Y h:i.... etc". The second function processes the select object on submit back to unix time. Categories : PHP, Calendar, Date Time, HTML and PHP | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | Multiple Select box, Select multiple Items from Menu.List box Categories : PHP, HTML and PHP, Beginner Guides | | | Newbie Notes #1 - Making a form return to itself Categories : PHP, Beginner Guides, HTML and PHP | | | mySQL/PHP/search with multientry
form and table output with colored rows Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases | | | Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | Form Submission Using Array's Categories : PHP, HTML and PHP, Beginner Guides, Arrays | | | CALENDAR - easy calendar-navigation with PHP Categories : PHP, Date Time, HTML and PHP, Calendar | | | Script loading time Categories : PHP, Beginner Guides, Date Time | | | Local-to-user date and time display regardless of time zone or where the website's server is located Categories : PHP, Date Time, HTML and PHP, Java Script | | | Simple PHP Form Field Generator Categories : PHP, Beginner Guides, Form Processing, HTML and PHP | |
| | | | Ioannis Cherouvim wrote :1629
Try refactoring your code using some http://www.weberdev.com/for loops.
| |
|
|