get value by today yesterday in laravel 1

get value by today yesterday in laravel

$yesterday = date("Y-m-d", strtotime( '-1 days' ) );

Here is what the above code is Doing:
1. We’re creating a variable called $yesterday and setting it equal to the date of yesterday.
2. We’re using the date() function to create a date string.
3. We’re using the strtotime() function to get the timestamp of yesterday.
4. We’re passing the string ‘-1 days’ to the strtotime() function to get the timestamp of yesterday.

Similar Posts