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

Answer: How can I format the output of localtime?

by reptile (Monk)
on Jun 04, 2000 at 02:26 UTC ( #16232=categorized answer: print w/replies, xml ) Need Help??

Q&A > dates and times > How can I format the output of localtime? - Answer contributed by reptile

localtime takes those big weird numbers (which btw are the number of seconds since the epoch, which is normally Jan 1. 1970) and returns either the ctime(3) string in scalar context, or an array of values describing the date. Look on the localtime manpage for more.

You can also look at Date::Format on CPAN. With that, something like:

time2str("%D", $time);

will format $time to the "MM/DD/YY" format you were looking for. See Date::Format's documentation for all the format specifiers.

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2020-10-25 20:55 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (249 votes). Check out past polls.