Little website help

Associate
Joined
11 Mar 2007
Posts
1,741
Morning all

I'm designing a website and I need a bit of help. The chap I'm designing for has regular meetings on the 1st Saturday of each month and I want to put the date of the next meeting on the website. So is it possible to write a script that displays the date of the next meeting automatically?


Yes I know I could just write 'Every first Saturday' but that's not quite as slick. What I'm really after is something that keeps consistently up to date, ie not something that realies on me pre-writing a load of dates for Saturdays and the script comparing them to a calendar.

Hope that's clear, any help appreciated.
 
Are you using PHP? If so you could use the following:
PHP:
<?php

function nextFirstSaturday() {
	if (date('j', strtotime('first saturday')) > 7) {
		return date('U', strtotime('first saturday next month'));
	}
	else {
		return date('U', strtotime('first saturday'));
	}
}

echo date('l jS F (Y-m-d)', nextFirstSaturday());

?>
 
Words simply cannot express how much I love you right now :) Works a treat, and PHP is actually even better than JScript!!!

Thanks again :)
 
Back
Top Bottom