Call us Toll-Free:
1-800-218-1525
Email us

 Sponsors

Find Last Day of Month

Code Wizard, 12-30-2006

A very simple function that returns the last day of the month.

<?php
function LastDayOfMonth($month){
/*
The number of days in each month.
The first entry in this array represents January
*/
$DaysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);


/*
Get the Last day of month
*/
$LastDay = $DaysInMonth[$month - 1];

return $LastDay;

}
//Create a variable to store the value returned from the function
$LastDayOfCurrentMonth = LastDayOfMonth(date(n));


//Output
echo $LastDayOfCurrentMonth;

?>
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions