Function Friday: Cal_days_in_month ()
Friday February 29, 2008
I'm going to start a new tradition of featuring a different function every Friday. Since today is Febuary 29th, leap year, I thought we'd feature the Cal_days_in_month () PHP Function. The number of days in each month is usually static, with the exception being February having an extra day every forth year. One simple way to check if it is leap year, is to run something like this:
<?phpThis will return the number 29, since there are 29 days in the 2nd month (February) of 2008 on the Gregorian calendar.
$num = cal_days_in_month(CAL_GREGORIAN, 2, 2008) ;
echo $num;
?>


No comments yet. Leave a Comment