PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
photo of Angela Bradley

Angela's PHP / MySQL Blog

By Angela Bradley, About.com Guide to PHP / MySQL

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:
<?php
$num = cal_days_in_month(CAL_GREGORIAN, 2, 2008) ;
echo $num;
?>
This will return the number 29, since there are 29 days in the 2nd month (February) of 2008 on the Gregorian calendar.

Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Discuss

Community Forum

Explore PHP / MySQL

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

©2009 About.com, a part of The New York Times Company.

All rights reserved.