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

Re: Problem with DateTime subtract_datetime

by runrig (Abbot)
on Feb 18, 2015 at 21:40 UTC ( [id://1117153]=note: print w/replies, xml ) Need Help??


in reply to Problem with DateTime subtract_datetime

Seems to work okay for me. Give an example that "doesn't" work. Possibly use the 'in_units()' method to return something less confusing?
  • Comment on Re: Problem with DateTime subtract_datetime

Replies are listed 'Best First'.
Re^2: Problem with DateTime subtract_datetime
by phildeman (Scribe) on Feb 19, 2015 at 16:59 UTC

    So, if $endDate = "2015-02-24", the result I am getting is 5 months, 2 weeks, 0 days. Whereas, the result should be 0 months, 0 weeks, 5 days.

    However, if $endDate = "2015-06-16' the result is: 3 months, 3 weeks, 3 days. That is correct.

      I get the correct answer, although it's '4 days 11 hours'. Perhaps you should be using 'today()' instead of 'now()' ? Also, try to write an example that doesn't use today() or now(), and uses fixed dates, so that the example will behave the same tomorrow.
      Please note, my response is based on today's date (2015-02-19).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 07:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found