http://qs321.pair.com?node_id=548476


in reply to How can I convert epoch seconds to date format

not sure on what you are exactly trying to do, but for conversions from epoch to localtime you can use 'localtime'
perldoc -f localtime

localtime EXPR
       localtime
               Converts a time as returned by the time function to a 9-element
               list with the time analyzed for the local time zone.  Typically
               used as follows:

                   #  0    1    2     3     4    5     6     7     8
                   ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                                               localtime(time);
Or you can use one of the many modules that does dateconversions, my current favorite is DateTime.
  • Comment on Re: How can I convert epoch seconds to date format

Replies are listed 'Best First'.
Re^2: How can I convert epoch seconds to date format
by bigmacbear (Monk) on May 10, 2006 at 22:38 UTC

    This won't help the OP necessarily, but if you just want to display human-readable date and time without mucking with the data structure, remember that localtime() and gmtime(), when used in scalar context, return a string in the default format defined by ctime(3).