About calculating number of days in a month

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bckennyw
Forum Newbie
Posts: 11
Joined: Wed Nov 26, 2003 10:25 am

About calculating number of days in a month

Post by bckennyw »

The hosting service I have did not compile PHP with "--enable-calendar". It seems that I am not able to call the functions associated with calendar.

Is there anyway I can still get the number of days in a month?

Thanks!!!!!
User avatar
mchaggis
Forum Contributor
Posts: 150
Joined: Mon Mar 24, 2003 10:31 am
Location: UK

Post by mchaggis »

Yes, you can try doing it the old fashioned way ;)

Code: Select all

<?php
function daysinmonth ($month) {
    return date('j', mktime(0,0,0,($month+1),0,2003));
}
?>
Post Reply