Re: Date/Time Display for recurring monthly event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aragon@HELP wrote:
Having a heck of time getting anything to work, can anyone make a suggestion
to the following.

I need a webpage that displays 5 recurring meeting dates, i.e. the second
Wednesday, Thursday, and Friday of each month in five different locations.

<?php

  echo "Current Month: \n\n";
  echo date("r",strtotime("second Wednesday"))."\n";
  echo date("r",strtotime("second Thursday"))."\n";
  echo date("r",strtotime("second Friday"))."\n\n";

  echo "Next Month: \n\n";
echo date("r",strtotime("second Wednesday",strtotime("1st October")))."\n"; echo date("r",strtotime("second Thursday",strtotime("1st October")))."\n"; echo date("r",strtotime("second Friday",strtotime("1st October")))."\n\n";

  echo "For all months of the year (for loop way) : \n\n";
  for($x = 1; $x <=12; ++$x)
  {
    $current_month = date("F",mktime(0,0,0,$x,1,date("Y")));
    echo 'For the month of '.$current_month.":\n\n";
echo date("r",strtotime("second Wednesday",strtotime("1st ".$current_month)))."\n"; echo date("r",strtotime("second Thursday",strtotime("1st ".$current_month)))."\n"; echo date("r",strtotime("second Friday",strtotime("1st ".$current_month)))."\n\n";
  }

  echo "For all months of the year (array_map way) : \n\n";

  function findDates($month)
  {
    $current_month = date("F",mktime(0,0,0,$month,1,date("Y")));
$x[] = date("r",strtotime("second Wednesday",strtotime("1st ".$current_month))); $x[] = date("r",strtotime("second Thursday",strtotime("1st ".$current_month))); $x[] = date("r",strtotime("second Friday",strtotime("1st ".$current_month)));
    return $x;
  }

  $dates = array_map('findDates',range(1,12));
  echo 'For the month of December : '."\n";
  print_r($dates[11]);

?>

Enjoy :)

--
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux