in reply to Error from timelocal

timelocal "converts a time as returned by the time function to a 9-element list with the time analyzed for the local time zone" - it's input is a simple number, not a list.

update: my fault. I was talking about localtime. Sorry.

Replies are listed 'Best First'.
Re: Re: timelocal
by MarkM (Curate) on Dec 20, 2002 at 19:46 UTC

    Actually, timelocal() converts a 6 element list into a time value. localtime() converts a time value into a 9 element list.

    Without knowing what the error is, I would suspect that the error is that timelocal() expects the month to be 0-based, and the year to be the offset from 1900.

    Also, I would recommend that 'use Time::Local' be used, and not 'require "timelocal.pl"'. (timelocal.pl is implemented in terms of Time::Local, therefore 'require "timelocal.pl"' is unnecessary obscurity)