domingo, 25 de junio de 2023

get the the monday and sunday from a week a go

 <?php

// Get the current date

$currentDate = date('Y-m-d');


// Calculate the previous week's Monday

$previousMonday = date('Y-m-d', strtotime($currentDate . ' -1 week monday'));


// Calculate the previous week's Sunday

$previousSunday = date('Y-m-d', strtotime($currentDate . ' -1 week sunday'));


// Display the results

echo "Previous Week's Monday: " . $previousMonday . "<br>";

echo "Previous Week's Sunday: " . $previousSunday . "<br>";

?>


No hay comentarios:

Publicar un comentario