This works for most months, but for example, April 2011 has 5 saturdays, so this returns 23 instead of 30.
$last_saturday = date("j", strtotime('Fourth Saturday'.date('F o')));
This works for most months, but for example, April 2011 has 5 saturdays, so this returns 23 instead of 30.
$last_saturday = date("j", strtotime('Fourth Saturday'.date('F o')));
last saturday
seems to be interpreted as "previous saturday" in some constellations.
This is what works for me on PHP 5.3 on Windows 7: Jump to next month's first day, and look for last saturday.
$nextMonthStart = mktime(0,0,0,date('m')+1,1,date('Y'));
$last_saturday = date("d.m.Y",strtotime("previous saturday", $nextMonthStart));
works for me even in the edge case that the first day of next month is a saturday.