User Defined Tag to display recurring date (e.g., meeting date)
Posted: Mon Mar 03, 2008 3:47 am
Our civic club wanted to post a recurring notice of our monthly meetings so I did some searching and found the PHP code that would do this. It's now a User Defined Tag which displays each month's recurring meeting (in this case, the second Monday of every month).
Here's the code for this tag:
Apparently PHP has some problems with declaring "second Monday" so I changed that to "2 Monday" and it works perfectly. You can see it in action here: http://www.idylwood.org
Here's the code for this tag:
Code: Select all
$t=getdate();
$today = mktime(0,0,0,$t['mon'],$t['mday'],$t['year']);
$this_month_start = mktime(0,0,0,$t['mon'],1,$t['year']);
$next_month_start = mktime(0,0,0,$t['mon']+1,1,$t['year']);
$this_month_date = strtotime("2 Monday",$this_month_start);
$next_month_date = strtotime("2 Monday",$next_month_start);
if($today <= $this_month_date) {
$event_date = $this_month_date;
} else {
$event_date = $next_month_date;
}
print "Monday, ".date('F j, Y',$event_date)." 7:00pm St. Austin Center";