How to Get Yesterday Date in PHP Example?
Hi Friends,
You will learn how to get previous day date in php. you can see php get yesterday date. Let's see bellow example php get previous date.
In this post, we will learn how to get yesterday date in php. if you have question about how to get previous date in php then i will give simple example with solution.
I will give you very simple example how to yesterday date in PHP.
Example 1:
index1.php
<?php
$newDate = date('Y-m-d', strtotime('-1 days'));
echo $newDate;
?>
Output:
2021-11-17
Example 2:
index2.php
<?php
$newDate = date('Y-m-d', strtotime('yesterday'));
echo $newDate;
?>
Output:
2021-11-17
i hope it can help...
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example