How to Get Yesterday Date in PHP?
In this post, we will learn how to get yesterday date in php.
1. Code:
<?php function getYesterdayDate(){ $yesterdayDate = date('Y-m-d', strtotime('yesterday')); return $yesterdayDate; } echo getYesterdayDate(); ?>
2. Example
Output:
current day: 2022-09-19 ouput: 2022-09-18