GET LAST WEEK DATES USING CUSTOM DATE

GET PREVIOUS WEEK DATES USING CUSTOM DATE IN PHP

@author : Shubham Maurya,
Email id : maurya.shubham5@gmail.com
**/

Hi all , Welcome to shubhammaurya.com , Today we are going to discuss , how to get previous week dates from a custom date/user given date.

We will use strtotime() function to get all dates.

<?php

// set Custom rent date
$date = strtotime('2021-05-12'); //Custom Date

$previous_monday = strtotime("last week monday",$date);
$previous_friday= strtotime("last week friday",$date);

echo "<br> last week monday : ".date('Y-m-d',$previous_monday)."<br>";
echo "<br> last week friday : ".date('Y-m-d',$previous_friday)."<br>";

?>
GET LAST WEEK DATES USING CUSTOM DATE

Click here to view this on GitHub

Comment Below, If any problem occurs.

STAY CONNECTED FOR MORE

By jackmaurya121

Hi , My Name is Shubham Maurya and i am currently working as a Project Manager.