Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Human Readable Date

by edan (Curate)
on Jan 18, 2005 at 10:24 UTC ( #422961=note: print w/ replies, xml ) Need Help??


in reply to Human Readable Date

What's wrong with the perl builtin functions localtime or gmtime? To get a human readable string from epoch time you can simply:

my $str = scalar localtime $s->mtime();

Substitute localtime with gmtime if you need GMT time. If you want more control over the format of the time, look at POSIX::strftime(), as in the following example:

use POSIX qw/strftime/; my $str = POSIX::strftime "%F %T", localtime $s->mtime();
--
edan


Comment on Re: Human Readable Date
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-07-13 13:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (249 votes), past polls