<?php
//Wrong DateInterval first Monday of January 2020, it progress year (+1, +2, etc) not have start or end this class.
$timezone = new DateTimeZone( "UTC" );
$fmj = DateInterval::createFromDateString( 'first Monday of next month' );
$period = new DatePeriod( new DateTime( '2019-01-01 00:00:00.000000', $timezone ), $fmj, new DateTime( '2022-01-11 00:00:00.000000', $timezone ) );
$y = 0;
foreach ( $period as $dt ) {
$c[] = $period;
$display[$y++] = $dt->format( "l Y-m-d H:i:s" );
//stop total_recurrence
if( $y == 36 ) {
break;
}
}
$var = new DateTime( 'first monday of January', new DateTimeZone( "UTC" ));
$display[36] = 'this relative date for DateTime class ' . ($var->format( "l Y-m-d H:i:s" ));
var_dump( $display, $fmj, $c);
preferences:
28.21 ms | 402 KiB | 5 Q