0

Hi,

Ho do i find out which month has how many days with PHP? Ok July is 31 days but, how can i calculate it?

Thanks

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by veledrom
0

Take a look at the date() function in the PHP Manual ( found at http://au.php.net/manual/en/function.date.php ). There is a special format, t, that returns the number of days in a given month. For example, to find the number of days in July, you could write something like:

$julyDays = date('t', mktime(0, 0, 0, 7, 1, 2008));

since the mktime() function makes a time for the supplied hour, minute, second, month, day and year.

Hope this helps :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.