in reply to Re^2: epoch time
in thread epoch time

I think timelocal() wants the year to be years since 1900

It accepts both.

why not set the hash up with the subtraction by one already done?

I like $m having a natural value like $d (1..~31) and $y (19xx) do. I always follow localtime and gmtime with $m++; $y += 1900;, and I always specify $m-1 for timelocal and timegm. Not seeing $m-1 raises alarms in my head.

Replies are listed 'Best First'.
Re^4: epoch time
by johngg (Canon) on Jan 31, 2007 at 20:17 UTC
    It accepts both.

    Yes, davorg also pointed out my error. I had always thought that localtime() and timelocal() were essentially mirrors of each other. Now I know better. Re. your habitual $m-1, that's very sound reasoning; perhaps I should do the same.

    I saw davorg's reply to my post just as I was leaving work so I didn't have time to correct my error. I will do so now.

    Cheers,

    JohnGG