Reputation: 48983
I know there is a lot of info on the neton how to show yesterdays date but I am unable to get any of them to work in this format
How do you show yesterdays date if todays date is in this format date('F jS, Y') ?
July 27th, 2009 should show July 26th, 2009
//Does not work
$yesterday = date('F jS, Y', mktime(0, 0, 0, date("F") , date("j") - 1, date("Y")));
echo $yesterday;
Upvotes: 0
Views: 984
Reputation: 488714
Use the very awesome strtotime:
$today = 'July 27th, 2009';
$yesterday = date('F jS, Y', strtotime('yesterday', strtotime($today)));
print $yesterday; // July 26th, 2009
Upvotes: 7