Ben Clapp wrote:
I am new to PHP programming and need some help. I have an image that i
have show up each May for the month with $mymonth = date("m", mktime()),
but i want to set up a date range for it to show up. Ex. 4-13 to 5-13
each year. How can I do that? Any help would be great.
There are loads of ways, but hopefully as you're new to PHP this one
will be easy to follow and make sense:
$start_date = strtotime('4 August 2007');
$end_date = strtotime('9 October 2007');
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
// Do whatever should only happen between the
// 4th of August and the 9th of October here
}
strtotime() is extremely powerful / useful, and well worth reading about:
http://uk.php.net/manual/en/function.strtotime.php
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php