in reply to Re: Problem with DateTime subtract_datetime
in thread Problem with DateTime subtract_datetime

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.

  • Comment on Re^2: Problem with DateTime subtract_datetime

Replies are listed 'Best First'.
Re^3: Problem with DateTime subtract_datetime
by runrig (Abbot) on Feb 19, 2015 at 17:11 UTC
    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.
Re^3: Problem with DateTime subtract_datetime
by phildeman (Scribe) on Feb 19, 2015 at 17:04 UTC
    Please note, my response is based on today's date (2015-02-19).