<?php $date = new DateTime('2012-03-30'); $date->modify("last day of last month"); var_dump($date->format('Y-m-d')); // correctly last day of Feb $date->setDate(2012, 1, 30); var_dump($date->format('Y-m-d')); // incorrect date $date->modify('2012-01-30'); var_dump($date->format('Y-m-d')); // does set correct date
You have javascript disabled. You will not be able to edit any code.