How to Get the First Day Of Specific Month In Php ?
In this example,we helps you can easy and simply get the first day of specific month in php.
1. Code:
<?php
function getTheFirstDayOfSpecificMonth($date){
$theFirstDayOfSpecificMonth = date('Y-m-01', strtotime($date));
return $theFirstDayOfSpecificMonth;
}
$date = '2022-01-10';
echo getTheFirstDayOfSpecificMonth($date);
?>
2. Example:
Input:
date = '2022-01-10';
Output:
2022-01-01