Gossamer Forum
Home : Products : DBMan : Customization :

Showing records in last week

Quote Reply
Showing records in last week
Anyone know how I can automatically show all records from my database that were added in the last week?

I'm already using the date mod that accepts either the 6/1/01 format or the 1-June-2001 format if that makes a difference.

Any help you can give is much appreciated.

Quote Reply
Re: Showing records in last week In reply to
have you checked these areas?

resources <-- part of Gossamer Threads and
You may want to check our JPDeni's excellent DBMan tutorial.
http://jpdeni.com/dbman

And LoisC's excellent resource
Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/


Thanks to them both.


I'm pretty sure there was mod to do this called "what's new"

good luck

**************************************
on the pages in between ...
Quote Reply
Re: Showing records in last week In reply to
http://webmagic.hypermart.net/dbman/date21.txt

You can modify this code:
elsif ($in{'future'}) {
$in{'Date-lt'} = &get_date(time() + ($in{'future'} * 86400));
$in{'Date-gt'} = &get_date(time() - 86400);
}
Do something like:
if ($in{'lastweek'}) {
$in{'Date-lt'} = &get_date(time() - 7 * 86400));
$in{'Date-gt'} = &get_date(time());
}
This will use today's date minus seven days as the lower margin of the range and today's date as the upper margin. It assumes that you have a name-value-pair like "lastweek=1" in the query-string, and that by "last week" you mean today minus seven days.
If you want to do something like "today is Wednesday the 13th, and last week means everything in between Sunday the 3rd and Sunday the 10th", then things get more complicated.


kellner
Quote Reply
Re: Showing records in last week In reply to
Thanks all for the help, I got it up and working now.