Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How can I convert epoch seconds to date format

by eXile (Priest)
on May 10, 2006 at 14:51 UTC ( #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
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
Node Status?
node history
Node Type: note [id://548476]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2014-12-19 09:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (75 votes), past polls