<?php
$d = new DateTime( '2010-01-31' );
//$d->modify( 'first day of next month' );
//$day=$d->toString( 'last day of +1 month', now());
//echo $day->toString('yyyy-MM-dd');
echo $d;
Fatal error: Uncaught Error: Object of class DateTime could not be converted to string in /in/aWZh7:6
Stack trace:
#0 {main}
thrown in /in/aWZh7 on line 6
Process exited with code 255.