php date loop

Solutions on MaxInterview for php date loop by the best coders in the world

showing results for - "php date loop"
Francesco
20 May 2019
1$startTime = strtotime( '2010-05-01 12:00' );
2$endTime = strtotime( '2010-05-10 12:00' );
3
4// Loop between timestamps, 24 hours at a time
5for ( $i = $startTime; $i <= $endTime; $i = $i + 86400 ) {
6  $thisDate = date( 'Y-m-d', $i ); // 2010-05-01, 2010-05-02, etc
7}
8