$dateCurrent = new \DateTimeImmutable(date('Y-m-d', mktime(0, 0, 0, $month, $dayCurrent, $year)));
$interval = DateInterval::createFromDateString('1 day');
$period = new \DatePeriod($startDate, $interval, $dateCurrent);
foreach($period as $dateTimePeriod) {
$dayNumber++;
}
object(DateInterval)#3 (16) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(1)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
object(DatePeriod)#4 (6) {
["start"]=>
object(DateTimeImmutable)#5 (3) {
["date"]=>
string(26) "2023-03-17 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Moscow"
}
["current"]=>
NULL
["end"]=>
object(DateTimeImmutable)#6 (3) {
["date"]=>
string(26) "2023-03-20 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Moscow"
}
["interval"]=>
object(DateInterval)#7 (16) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(1)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
["recurrences"]=>
int(1)
["include_start_date"]=>
bool(true)
}
object(DateTimeImmutable)#1 (3) {
["date"]=>
string(26) "2023-03-17 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Moscow"
}
object(DateTimeImmutable)#2 (3) {
["date"]=>
string(26) "2023-03-20 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/Moscow"
}
<?php
$date1 = new \DateTimeImmutable(date('Y-m-d')); // Сегодня
$date2 = new \DateTimeImmutable(date('Y-m-d', mktime(0, 0, 0, 3, 20, 2023))); // Через 3 дня
$interval = DateInterval::createFromDateString('1 day');
$period = new \DatePeriod($date1, $interval, $date2);
var_dump( $period -> getRecurrences() ); // NULL :(((((
?>
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun8iw7p1_mainline_defconfig