Mega Code Archive

 
Categories / Php / Strings
 

Finding the Date for a Weekday

<?php   echo 'Today is ' . date('d M Y') . '.';      for($i = 1; $i <= 12; $i++)   {     $nextmonth = date('Y-' . (date('n') + $i) . '-01');     $nextmonth_ts = strtotime($nextmonth);     $firsttue_ts = strtotime("Tuesday", $nextmonth_ts);          echo '<br />The first Tuesday of ' . date('F', $firsttue_ts)        . ' is ' . date('d M Y', $firsttue_ts) . '.';   } ?>