Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How can I convert epoch seconds to date format

by eXile (Priest)
on May 10, 2006 at 14:51 UTC ( [id://548476]=note: print w/replies, xml ) Need Help??


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).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://548476]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-19 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found