Using ParseDate in for loop

Hi,

I’m trying to use ParseDate within a for loop but I get this error:

can’t dup NilClass

Any suggestions for making this work?

Thanks,
-Jason

Jason,

That’s not nearly enough info for anyone to help with your problem.
Parsedate, of course, works just the same whether it’s in a for loop
or not. Try posting some actual code.

Cheers,

Pete Y.
http://9cays.com/

for res in @response
date1 = Date.today
date2 = ParseDate.parsedate(date_from_string)

if  (date1 - date2 <= 365)
    count1 += 1
end

end

The thing that’s likely to be causing your error is that
date_from_string is nil.

(There are also several other problems with your code, but I’ll let
you cross those bridges as you come to them.)

Pete Y.
http://9cays.com/