Re: Function mktime() documentation question
| From: | shiplu | Date: | Wed, 07 Mar 2012 23:51:18 +0000 |
| Subject: | Re: Function mktime() documentation question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316935@lists.php.net to get a copy of this message | ||
> To get the number of days for a specific month, I use:
>
> // $current_month is the month under question
>
> $next_month = $current_month + 1;
I use this
$next_month = $current_month + 1;
$next_month_1 = mktime(0, 0, 0, $next_month, 1, date("Y") );
$current_month_1= mktime(0, 0, 0, $current_month, 1, date("Y") );
$mdays = ($current_month_1 - $next_month_1)/(3600*24);
It's much more easier if you use DateTime and DateInterval class
--
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader