[php] PHP date yesterday

Possible Duplicate:
Get timestamp of today and yesterday in php

I was wondering if there was a simple way of getting yesterday's date through this format:

date("F j, Y");

This question is related to php date

The answer is


strtotime(), as in date("F j, Y", strtotime("yesterday"));


How easy :)

date("F j, Y", strtotime( '-1 days' ) );

Example:

echo date("Y-m-j H:i:s", strtotime( '-1 days' ) ); // 2018-07-18 07:02:43

Output:

2018-07-17 07:02:43