PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $startDate = date('Y-m-d', strtotime('+2 years')); $currentDate = $startDate; $oddDays = []; while ($currentDate <= date('Y-m-d')) { $dayOfMonth = date('j', strtotime($currentDate)); if ($dayOfMonth % 2 !== 0) { $oddDays[] = $currentDate; } $currentDate = date('Y-m-d', strtotime("$currentDate +1 day")); } $oddDaysString = implode(',', $oddDays); echo $oddDaysString;
Show:  
Copy Clear