Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: What's "Better" DateTime or localtime?

by runrig (Abbot)
on Jul 11, 2013 at 18:22 UTC ( #1043808=note: print w/replies, xml ) Need Help??


in reply to Re^2: What's "Better" DateTime or localtime?
in thread What's "Better" DateTime or localtime?

So since it uses "localtime" does that mean when you include the Module, that it actually modifies what localtime will output?

By default, yes, it exports and overrides localtime. If you don't want to do that, you can import nothing:

use Time::Piece qw();
If I do want to override localtime, I will usually explicitly import it:
use Time::Piece qw(localtime);

Replies are listed 'Best First'.
Re^4: What's "Better" DateTime or localtime?
by mmartin (Monk) on Jul 11, 2013 at 19:04 UTC
    After playing around with the Time::Piece Module for a bit I think I'm going to use that instead as you suggested.

    It seems like there's a ton more Methods available for it including this one which is cool --> $date->mdy("/").
    It looks like there is about, like 50-60 methods available for the Module so it seems pretty flexible...

    I like it!

    Thanks Again,
    Matt

      Don't forget that Time::Piece delegates strftime() and strptime() too! :)

      perl -MTime::Piece -le'print localtime->strftime("%m/%d/%Y %T")'


      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      
Re^4: What's "Better" DateTime or localtime?
by mmartin (Monk) on Jul 11, 2013 at 18:49 UTC
    Hey runrig, thanks again for the reply!

    Ahh haa, Ok that makes sense... Cool, thanks for the info!


    Thanks Again,
    Matt

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043808]
help
Chatterbox?
[Corion]: Meh. I need to find myself a better "programming" feed than r/programming (which is just HackerNews reposts and advertisements, very little code). Maybe I should select a list of links that I liked on r/programming and then google for ...
[Corion]: ... an aggregator site that also listed (ideally) all of these links once. And maybe also have an exclude list to blacklist some of the most spammy links that the site may have never mentioned at all
[marto]: I gave up reading HN at all, and feel much better for it :P
[Corion]: Now, how to best automate that Google search ... :-)
[Corion]: marto: Yeah, I'm also short of not reading it at all. I already stopped reading it in the morning because it gave me a foul mood.
[Corion]: The good posts on HN are the non-computing posts. Most of the other stuff is maybe relevant to you if you are 20 and live in Silicon Valley...
[Corion]: Two attributes that don't describe me.
[Corion]: Maybe I should also write a curator for HN or simply not read it anymore, like you do.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-07-24 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (354 votes). Check out past polls.