On Thu, Mar 8, 2012 at 7:01 AM, Simon Schick <simonsimcity@xxxxxxxxxxxxxx> 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'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php