|
|
|
|
|
|
Like this code?
Show the author your appreciation.
|
| |
| <?php
for ($year = 2011; $year <= 2012; $year++){
for ($month = 1; $month <= 12; $month++){
$num_of_days = date("t", mktime(0,0,0,$month,1,$year));
echo "<b>Month=$month Year=$year </b><BR>";
echo "Number of days = $num_of_days <BR>";
$firstdayname = date("D", mktime(0, 0, 0, $month, 1, $year));
$firstday = date("w", mktime(0, 0, 0, $month, 1, $year));
$lastday = date("t", mktime(0, 0, 0, $month, 1, $year));
$lastdayname = date("D", mktime(0, 0, 0, $month, $lastday, $year));
echo "First day of the month = $firstday,$firstdayname <BR> ";
echo "Last day of the month = $lastday,$lastdayname <BR> ";
$no_of_weeks = 1;
$count_weeks = 0;
while($no_of_weeks <= ($lastday+$firstday)){
$no_of_weeks += 7;
$count_weeks++;
}
echo "Number Of weeks in Month=$month Year=$year = $count_weeks <br>";
}
}
?> | | |
|
| Find if a year is leap. Categories : PHP, Date Time, Beginner Guides, Data Validation | | | Script loading time Categories : PHP, Beginner Guides, Date Time | | | Local Time clock and Server time usign PHP and JavaScript Categories : PHP, Java Script, Date Time, Beginner Guides | | | How to Insert a Date Format Into MySQL from PHP Categories : PHP, Databases, MySQL, Date Time, Beginner Guides | | | Kewl Date Example Categories : PHP, HTML and PHP, Date Time, CSS, Beginner Guides | | | 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 | | | Find the day of the week for any given year/month/day. Categories : PHP, Date Time, Data Validation, Algorithms, Beginner Guides | | | a class that uses microtime() to provide easy calculation of elapsed times
Categories : Date Time, PHP, PHP Classes | | | Simple conversion functions to change MySQL dates to arrays, arrays to MySQL dates.
Categories : PHP, Arrays, Date Time, Databases, MySQL | | | function to generate calendars on the fly.
Categories : Calendar, PHP, Date Time | | | Newbie Notes #10 - Generating drop downs Categories : PHP, MySQL, HTML, Beginner Guides, Databases | | | Current Page's URL using PHP Categories : PHP, Beginner Guides, Global Variables | | | PHP Class to calculate Degrees Minutes Seconds to Decimal Degrees Categories : PHP, PHP Classes, Geo Related, Beginner Guides | | | Calendar, Kalender, date, time, day, month, year Categories : PHP, Date Time, Calendar | | | Simple Cookie example Categories : PHP, Beginner Guides, Cookies | |
| |
| |
|