Hi experts,
I'm working on something that will only display data in the "Last xx days" (Selected by user)
Here's what I have:
FYI:
$fields[14] is the string for the field in flat file that contains the date stamp in the following format: dd/mm/yyyy
$year,$mon,$mday is the current date
So if $input{NoDays} equals 5 (which is the Last 5 days) and the current date is 1/3/2004, well it's won't work because my statement is basically limited to the current month only.
Any input would be appreciated.
I'm working on something that will only display data in the "Last xx days" (Selected by user)
Here's what I have:
FYI:
$fields[14] is the string for the field in flat file that contains the date stamp in the following format: dd/mm/yyyy
$year,$mon,$mday is the current date
Code:
if ($input{'NoDays'}) {
my ($fld_day, $fld_mon, $fld_year) = split(/\//,$fields[14]);
if (($year-$fld_year==0) && ($mon-$fld_mon==0) && ($mday-$fld_day<=$input{'NoDays'})) {
push (@found_set,[@fields]) ;
}
}
So if $input{NoDays} equals 5 (which is the Last 5 days) and the current date is 1/3/2004, well it's won't work because my statement is basically limited to the current month only.
Any input would be appreciated.