Reputation: 872
I am successfully using following strtotime command with PHP 5.3
echo strtotime('last day of last month');
but unfortunately same command return empty value in PHP 5.1.6 I don't want to upgrade PHP as PHP 5.1.6 is default version in CentOs 5. I wonder if is there any altertive method to get same result in PHP 5.1.6
Upvotes: 0
Views: 1648
Reputation: 5933
This should to the trick, mate :D
strtotime('-1 second',strtotime(date('m').'/01/'.date('Y').' 00:00:00'))
If you echo this as a date you'd get 02/28/2011.
Upvotes: 1