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')));
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
last saturdayseems 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.
works for me even in the edge case that the first day of next month is a saturday.