« first day (753 days earlier)      last day (1675 days later) » 

11:43
$date = DateTime::createFromFormat('Y-m-d', '2013-01-30');
$expectedMonth = $date->format('n');
$date->modify('+1 month');
if ($date->format('n') !== $expectedMonth) {
    $date->modify('last day of last month');
}
echo $date->format('Y-m-d');
@iroegbu ^^ is what I have done
2 messages moved from PHP
 
8 hours later…
20:01
I have a
struct pair
{
char *x;
int y;
};
1 message moved from Lounge<C++>

« first day (753 days earlier)      last day (1675 days later) »