Alex Rivera | Logout

PHP date yesterday

Asked 2011-07-22T22:44:24.893
129

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");
Edit
Report

1 Answer

111

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
answered 2012-09-25T09:19:52.053

Your Answer