Archive for the ‘PHP Tips and Tricks’ Category

Adding date to the website with PHP code snipped

Sunday, November 11th, 2007

If you are running PHP powered website to display a date requires one simple code snippet:

<?php echo (date("l, F d, Y"));?>

This code will show date as: “Sunday, November 11, 2007″

To use different formats you can visit PNP.net website for more variables.

To change appearance of the date display just put the code snippet inside of <div></div> or <span></span> tags and assign some styles to it.
For example following style:

div.date
{ font-family:Georgia;
font-size:12px;
font-weight:bold;
color:#0000FF;
}

Will display the date like this:

Sunday, November 11, 2007

That’s it!