WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Kewl Date Example
Categories : PHP, HTML and PHP, Date Time, CSS, Beginner Guides Click here to Update Your Picture
tedd sperling
Date : Mar 09th 2006
Grade : 1 of 5 (graded 3 times)
Viewed : 6603
File : 4352.zip
Images : No Images for this code example.
Search : More code by tedd sperling
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

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 Calender
Categories : PHP, HTML and PHP, Calendar, Date Time, CSS
XDT Topsite (Gold v1.0)
Categories : Databases, CSS, PHP, HTML and PHP, Sessions
Dynamic CSS generation for multiple website colouring schemes.
Categories : PHP, CSS, HTML and PHP
Simple Javascript CSS Digital Clock
Categories : Java Script, Date Time, CSS, Beginner Guides, Web Design
PHP alternating the colors of table rows with style.
Categories : PHP, HTML and PHP, CSS
If you want to create select buttons featuring current date this example will show you how...
Categories : Date Time, HTML and PHP, PHP
Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used.
Categories : HTML and PHP, PHP, Date Time
Newbie Notes #1 - Making a form return to itself
Categories : PHP, Beginner Guides, HTML and PHP
Website colour changer
Categories : PHP, HTML and PHP, Date Time
CALENDAR - easy calendar-navigation with PHP
Categories : PHP, Date Time, HTML and PHP, Calendar
Form Submission Using Array's
Categories : PHP, HTML and PHP, Beginner Guides, Arrays
Simple PHP Form Field Generator
Categories : PHP, Beginner Guides, Form Processing, HTML and PHP
How to preset a text string in a textarea input field
Categories : HTML, HTML and PHP, PHP, Beginner Guides
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
Multiple Select box, Select multiple Items from Menu.List box
Categories : PHP, HTML and PHP, Beginner Guides
 Ioannis Cherouvim wrote :1629
Try refactoring your code using some http://www.weberdev.com/for loops.