in reply to add to localtime?

powerhouse,
Yes, you can do this sort of thing. There are a lot of modules on CPAN for date/time manipulation and my personal favorite is Time::Local. It will allow you to translate a human readable date back into seconds since epoch. It doesn't get much simpler than that unless you want to create a sub to handle calculating the seconds that can be hidden away and be re-used.

Cheers - L~R

Update follows:

my $saleend = get_time($in{'saleend'); my $salestart = get_time($in{'salestart'); # nasty sub hidden away sub get_time { my $input = shift; if ($input eq "always") { return time() + (365 * 24 * 60 * 60); } else { return time() + ($input * 24 * 60 * 60); }

Cheers - L~R
Update: Modified localtime to time

Replies are listed 'Best First'.
Re: Re: add to localtime?
by powerhouse (Friar) on Apr 26, 2003 at 21:34 UTC
    For some reason this code: localtime()+(param("saleend") * 24 * 60 * 60) is putting the output of 604800 which is the param("saleend" * 24 * 60 * 60) (saleend is equal to 7).

    Why would localtime() not have a value? Is it NOT a built in Perl function?

    thx,
    Richard
      localtime() returns either an array of numbers representing seconds, minutes, hours, etc., or a string that represents date/time in a human readable form.
      What you need there is time(), not localtime().

      --perlplexer
        Excellent, time() worked! Thank you!!!

        thx,
        Richard