Please show me the code. That can help me know how many posts added to my forum today.
Sep 11, 2002, 10:13 AM
Administrator (9387 posts)
Sep 11, 2002, 10:13 AM
Post #2 of 3
Views: 1387
Hi,
Try:
my @now = localtime;
my $today = GT::Date::timelocal(0, 0, 0, $now[3], $now[4], $now[5]);
my $cond = GT::SQL::Condition->new(
'post_time', '>=', ', $today
);
my $count = $DB->table('Post')->count( $cond );
return $count;
}
The tricky part is figuring out the unix time for midnight today. If you want all posts in the last 24 hours, that's a lot easier. This isn't tested but should work.
Cheers,
Alex
--
Gossamer Threads Inc.
Try:
Code:
sub { my @now = localtime;
my $today = GT::Date::timelocal(0, 0, 0, $now[3], $now[4], $now[5]);
my $cond = GT::SQL::Condition->new(
'post_time', '>=', ', $today
);
my $count = $DB->table('Post')->count( $cond );
return $count;
}
The tricky part is figuring out the unix time for midnight today. If you want all posts in the last 24 hours, that's a lot easier. This isn't tested but should work.
Cheers,
Alex
--
Gossamer Threads Inc.