Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Time in Perl (examples in PerlMonks Q&A dates-and-times section, plus (s)printf)

by ybiC (Prior)
on Apr 28, 2002 at 02:36 UTC ( [id://162590]=note: print w/replies, xml ) Need Help??


in reply to Time in Perl

As good monk belg4mit said, localtime is likely may be what you're looking for. The local perldoc is your friend, as is the PerlMonks search form at the upper left.   But to get you started, try QandASection: dates and times, which contains several examples that may help.

Update: Depending on what you're going to do with your human-readable date/timestamp, printf (print a formatted string) and sprintf (return a formatted string) may also be worth delving into.

Oh yeah, and welcome to the Monastery!
    cheers,
    Don
    striving toward Perl Adept
    (it's pronounced "why-bick")
  • Comment on Re: Time in Perl (examples in PerlMonks Q&A dates-and-times section, plus (s)printf)

Replies are listed 'Best First'.
Re: Re: Time in Perl (examples in PerlMonks Q&A dates-and-times section, plus (s)printf)
by {NULE} (Hermit) on Apr 28, 2002 at 14:50 UTC
    To add a bit to what brother ybiC states there is another function that has made my life piles easier.
    use POSIX; print strftime("%Y-%m-%d %H:%M:%S", localtime),"\n"; # This displays the following: # 2002-04-28 10:52:32 # (Assuming I ran this when I was typing. {g})
    Do a man strftime to find out what all the formats are.

    {NULE}
    --
    http://www.nule.org

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-20 13:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found