in reply to Re: Convert epoch seconds to date
in thread Convert epoch seconds to date

@time = (localtime())[3..5]; $time[1]++; $time[2] += 1900; print join ('/', @time);
can't get it shorter :(

Replies are listed 'Best First'.
(tye)Re2: Convert epoch seconds to date
by tye (Sage) on Mar 19, 2001 at 21:33 UTC

    Update: I thought I was in a different thread so much of this is incorrect. My apologies to slayven. ):

    Note that this does d-m-yyyy which isn't what was asked for (the order is wrong and you don't pad with zeros).

    use mapcar; print join '-', mapcar {sprintf "%02d",pop()+pop} [(localtime())[5,4,3]],[1900,1,0];
    Is my contribution (which does yyyy-mm-dd since that is simply a better format).

    See mapcar -- map for more than one list for one needed part.

            - tye (but my friends call me "Tye")