How to get the first day of the week in PHP

PHP

In this tutorial, We will learn How to get on the first day of the week. We will use the strtotime() function to get the first day of the week. It will return returns the timestamp of the default time variable, then uses date() function to convert the date from the timestamp to a meaningful date.

<?php
setlocale(LC_TIME, “English”);
$firstDay = strftime(“%A – %d/%M/%Y”, strtotime(“this week”));
echo “First day of this week is: “, $firstDay;
?>

The post How to get the first day of the week in PHP appeared first on PHPGurukul.