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

Date arithmetic is not recommended

by space_monk (Chaplain)
on Oct 31, 2012 at 06:59 UTC ( #1001612=note: print w/replies, xml ) Need Help??

in reply to WWW::Mechanize wrong month

There are lots and lots of pitfalls in date arithmetic (leap seconds, February, leap years etc), so don't mess with dates when someone else has done it for you. Browse CPAN for an appropriate Date class (Class::Date, Date::Calc etc) and use that for all your date display formatting and calculations.

Replies are listed 'Best First'.
Re: Date arithmetic is not recommended
by gsparx (Novice) on Nov 02, 2012 at 22:55 UTC

    So that was the reason I was using Delta_DHMS from Date::Calc, because I wanted it to find the difference for me, but it seems like Date::Calc is not in fact ZERO based, but rather counts months from 1-12.

    I'm currently just incrementing the Month by 1 before I feed it into Delta_DHMS, and it seems to be working so far. So I should probably increment all the values in order to get the right day as well.

    Any other suggestions? Getting a date from WWW::Mechanize will mean it's ZERO based, so I wonder if I can get Date::Calc to take dates that are ZERO based rather than ONE based

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001612]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2018-02-20 23:59 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (274 votes). Check out past polls.