Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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
               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) =
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://548476]
[LanX]: met a guy from Aberdeen durin holidays, liked Scotsish accent a lot ... very phonetic
[LanX]: ... understood everything after mentally write down what he said.
[choroba]: Trainspotting?
[choroba]: Ouch, trailing commas in JSON :-(
[LanX]: ... though there seems to exist a taxation for the letter 't' in Northern Bri''ain ;-)
[LanX]: never seen trainspotting in OV ... :(
[karlgoethebier]: LanX

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2018-02-19 10:40 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (261 votes). Check out past polls.