Hello,

I've just started using DateTime, looked through the docs and FAQ's and
can't find the answer to this one:

I have a duration $dur = $dt_end - $dt_start and I would like to know how
many total weeks and/or days are in this span. How can that be easily
accomplished?

        $dur->months gives me the months in the span,
        $dur->weeks gives me the remainder of weeks, and
        $dur->day gives me the remainder of days.

Is that correct?

I pretty sure I'll run into leap year issues if I say ...

        $weeks = ($dur->months * 4) + 1

... or something like that.

I feel like I'm missing the blindingly obvious here.


Thanks,

Bill

Reply via email to