| ||||||||||||||||||
|
Back to ScriptsAdding a Calendar in HTMLCombining PHP date functionality with a one day calendar image. Very easy to set up, we demonstrate how to set it up using both PHP and Javascript.1. Server side Calendar using PHP <center> <table background="images/calendar.gif" width="50" height="60" cellpadding="0" cellspacing="0"> <tr><td align="center"> <font face="tahoma,arial" size="1"><?php echo date("M");?></font><br/> <font face="tahoma,arial" size="3"><?php echo date("d");?></font> </td></tr> </table> </center> The PHP outputs:
In a nutshell we follow 3 steps
To format the date differently, lets say we wished to display the month in a different format: echo date("m"); // displays the month numerically 01-12 echo date("n"); // displays the month numerically without a leading zero 1-12 echo date("F"); // displays the month textually January-December For a full list of date formating options goto http://php.net/date 2. Client side Calendar using javascript How would I do this on the client side using javascript? The same 3 steps are followed like we did with the PHP:
References: PHP.net reference manual for the function date Javascript Date Object |
|
|
contact us: elouai@gmail.com ©2003-2008 eLouai.com, All rights reserved |