Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates Manipulation 1

Status
Not open for further replies.

Alphabin

Programmer
Dec 8, 2002
119
CA
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

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.
 
hmm, I juyst have to think something else is going on outside the scope of what you are showing. Like maybe this is in some sort of outer loop that is clobbering data etc.

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top