Gossamer Forum
Home : Products : DBMan : Customization :

Searching Greater/Less than in date field

Quote Reply
Searching Greater/Less than in date field
I keep getting an : 'Invalid date format:' error when trying to use > or < in a date field. Is there any way to get around this?
Quote Reply
Re: Searching Greater/Less than in date field In reply to
I'm not sure if this is the problem, but there is a little bug in sub query in db.cgi

Look for a section in the subroutine that starts with

Code:
$i = 0;
foreach $column (@db_cols) {
if ($in{$column} =~ /^\>(.+)$/)

Go down a few more lines and change the code to look like the following. (I'll try to put the changes in bold print if I can remember what the original was.) I have rearranged the lines a little bit, but you should be able to follow it.

Code:
if ($in{"$column-gt"} !~ /^\s*$/) {
($db_sort{$column} eq 'date') and (&date_to_unix($in{"$column-gt"}) or return "Invalid date format: '$in{$column}'");
push(@search_gt_fields, $i); }
if ($in{"$column-lt"} !~ /^\s*$/) {
($db_sort{$column} eq 'date') and (&date_to_unix($in{"$column-lt"}) or return "Invalid date format: '$in{$column}'");
push(@search_lt_fields, $i); }

I think that's it. Give 'er a try.

------------------
JPD





Quote Reply
Re: Searching Greater/Less than in date field In reply to
That fixed it!

Thanks JP

Your are the best JP, the best!

MH