@darion
To get the date for yesterday in PHP, you can use the strtotime
function and pass in the string "-1 day"
.
Here is an example of how you can use this to get the date for yesterday in the Y-m-d
format:
1
|
$yesterday = date('Y-m-d', strtotime('-1 day')); |
This will set the variable $yesterday
to a string containing the date for yesterday in the Y-m-d
format. For example, if today is January 3, 2023, $yesterday
will be set to "2022-12-02"
.
You can also use other formats for the date by using a different format string in the date
function. For example, you can use "m/d/Y"
to get the date in the m/d/Y
format (e.g., "12/02/2022"
).
I hope this helps! Let me know if you have any other questions.