I need to take the following value
$todays_date = date('Y-m-d');
and calculate the previouse sunday
Example if todays date was 2002-06-02
I want to run a piece of code that would return 2002-05-26
How would you do this?
Thanks
<? $yr = date(Y); $mnth = date(m); $dy = date(d)-1; echo "last sunday: ".date("Y-m-d", mktime(0,0,0,$mnth,$dy-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."<br>"; ?>