Advertisement
Venciity

Lazy sundays

Aug 12th, 2014
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <?php
  2. $month = date("F");
  3. $year = date("Y");
  4. $totalDays = date("t");
  5.  
  6. for ($i = 1; $i <= $totalDays; $i++) {
  7.     $date = strtotime("$i $month $year"); // convert string to date
  8.     if (date("l", $date) == "Sunday") { // date("l", $date) --> A full textual representation of the day of the week
  9.         echo date("jS F, Y", $date). "<br />";
  10.     }
  11. }
  12.  
  13. // info : http://php.net/manual/en/function.date.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement