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

If so, the issue that months cannot be converted into days, since not all months have the same number of days. He would find $endDate->delta_days($dt1) more appropriate to his needs than $endDate->subtract_datetime($dt1)

Replies are listed 'Best First'.
Re^4: Problem with DateTime subtract_datetime
by flexvault (Monsignor) on Feb 19, 2015 at 22:46 UTC

    ikegami,

    I have read and re-read your comments several times, and I just don't understand how losing a month ( 28,29,30,31 days ) is not a problem. There is a finite number of days and weeks between the two dates.

    So, forget about the month(s), why are the weeks and days incorrect?

    Regards...Ed

    "Well done is better than well said." - Benjamin Franklin

      There is a finite number of days and weeks between the two dates.

      You didn't ask to the number of days and/or weeks between two dates. As I already mentioned, that would be $endDate->delta_days($dt1).

      So, forget about the month(s), why are the weeks and days incorrect?

      huh? They aren't. There is 1 month, 10 days, 17 hours and 1 minute between 2015-03-19 17:01 and 2015-02-30 00:00, and the output said 10 days.