RE: [PHP] Require some help about the date comparison
| From: | John Holmes | Date: | Wed, 17 Jul 2002 08:46:13 +0000 |
| Subject: | RE: [PHP] Require some help about the date comparison | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108043@lists.php.net to get a copy of this message | ||
> I want to display some text on web. This text should appear for
limited
> period e.g from 20th July 12pm till 25th July 3pm. After 25th July 3pm
the
> text should disappear from screen.
<?
//mktime(hour,minute,second,month,day,year)
$start = mktime(12,0,0,7,20,2002);
$end = mktime(15,0,0,7,25,2002);
$now = time();
if($now > $start && $now < $end)
{ //display text }
else
{ //text expired }
?>
Something like that. You can use strtotime() instead of mktime() if you
want...
---John Holmes...