Gossamer Forum
Home : Products : DBMan : Customization :

Searching the date field

Quote Reply
Searching the date field
Is it possible to search a date field??

I have the date stored as 26-Jul-2000 (added automatically when a new record is created) and would like to use this for searching e.g. Search all additions in Jul.

However, typing just 'Jul' in the form field gives: invalid format. If I type the exact date '26-Jul-2000' it works (case sensitive as well).

Best regards, Brian

Quote Reply
Re: Searching the date field In reply to
You could do a search of GREATER than 01-Jul-00, or LESS than 28-Jul-00, but I'm not aware of doing one in between the two. I've always just searched one or the other and then SORT BY DATE to get all of those dates together.
Hope that helps a little bit.


Conor Treacy
-----
www.HandsonWebDesign.com
Quote Reply
Re: Searching the date field In reply to
You can make a change that will allow a search like you want.

In db.cgi, sub query, look for

Code:

if ($in{$column} !~ /^\s*$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($in{$column}) or return "Invalid date format: '$in{$column}'");
push(@search_fields, $i); $i++; next; }
There are five lines that look similar. You want to work with the third one.

Change the above to

Code:

if ($in{$column} !~ /^\s*$/) {
push(@search_fields, $i); $i++; next; }
This will allow you to search for just part of a date.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Searching the date field In reply to
What a fantastic program Wink!!

Quote Reply
Re: Searching the date field In reply to
Yep. It's pretty darned cool. Smile

JPD
http://www.jpdeni.com/dbman/