Re: Function mktime() documentation question

From: Date: Thu, 08 Mar 2012 05:14:51 +0000
Subject: Re: Function mktime() documentation question
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-316937@lists.php.net to get a copy of this message
On Thu, Mar 8, 2012 at 7:01 AM, Simon Schick <simonsimcity@googlemail.com> wrote: > $date = new DateTime($year . '-' . $current_month . '-1'); > $date->add( new DateInterval( 'P1M' ) ); // Add a period of 1 month to > the date-instance (haven't tried that with the 30th of Jan ... would > be kind-of interesting) > > $days_in_current_month = $date->format('j'); // Get the date of the month I think you'd need to subtract it with 1 day date_create(date('Y-m'))->add(new DateInterval('P1M'))->sub(new DateInterval('P1D'))->format('d');

« previous php.general (#316937) next »