First of all, look at sub get_date in db.cgi. The first few lines should read:
Code:
my $time = @_;
($time) | | ($time = time());
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time);
If your sub get_date doesn't start like that, make it like that.
Before you print out your link (in html_home, probably) add (first closing off any
print qq| statement with a
|;)
Code:
$today = &get_date;
$days = 2 # actually this is the day before yesterday, but you're going to use "-gt"
$yesterday = &get_date(time() - ($days * 86400));
print qq|<a href="$db_script_link_url&Date=$today">Today's Ads</a>
<a href="$db_script_link_url&Date-gt=$yesterday&Date-lt=$today">Yesterday's ads</a>|;
That should work. However, I've seen some problems with calling the get_date subroutine. As a work-around I had to copy some of get_date into my routine. If the above doesn't work, use this instead:
Code:
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
@now = localtime(time());
($now[3] < 10) and ($now[3] = "0$now[3]");
$now[5] = $now[5]+1900;
$today = "$now[3]-$months[$now[4]]-$now[5]";
@then = localtime(time() - (2*86400));
($then[3] < 10) and ($then[3] = "0$then[3]");
$then[5] = $then[5]+1900;
$yesterday = "$then[3]-$months[$then[4]]-$then[5]";
print qq|<a href="$db_script_link_url&Date=$today">Today's Ads</a>
<a href="$db_script_link_url&Date-gt=$yesterday&Date-lt=$today">Yesterday's ads</a>|;
I know the above routine will work, but it's a little bit longer.
------------------
JPD
All my advice is offered on the basis of kindness-ware. If I've helped you to solve a problem, go out of your way to be kind to someone today.
[This message has been edited by JPDeni (edited March 02, 1999).]