How to Get Yesterday’s Date Using PHP?

You can use the following code to get yesterday’s date in PHP. To do this, we are using PHP’s built-in date() function.

Quick Tip : How to Get Previous / Next Record in Laravel?

<?php echo date("Y-m-d", time() - (60*60*24) ); ?>

<?php echo date("Y-m-d", strtotime("-1 day"));  ?>

<?php echo date("Y-m-d", strtotime("yesterday")); ?>

<?php echo date("Y-m-d", mktime(0, 0, 0, date("m"),date("d")-1,date("Y"))); ?>

For more information :


Leave a Comment.