Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
For more than 10 years, PHP has been providing very convenient methods for working with dates, which are unknown to the authors of video courses and - as a result - to the vast majority of users. For example, there is a DatePeriod
class suitable for this case
$begin = new DateTime( '2019-01-10' );
$end = new DateTime( '2019-02-10');
$end = $end->modify( '+1 day' ); // если надо включительно
$interval = new DateInterval('P1D');
$daterange = new DatePeriod($begin, $interval ,$end);
foreach($daterange as $date){
echo $date->format("Y-m-d") . "\n";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question