On Thu, 10 Jun 2004 [EMAIL PROTECTED] wrote:

> Matt Sisk wrote:
> > what is the midpoint of a span?
>
> With DateTime::Span:
>
>  $mid_point =
>     $span->start->add_duration(
>         seconds => $span->duration->seconds / 2
>     );
>
> With DateTime:
>
>   $mid_point =
>     $start->add_duration(
>         seconds => $end->subtract_datetime_absolute(
>             $start
>         )->seconds / 2
>     );

Oh, duh!  Why didn't I think of that.  That's nice & simple.

> How about a DateTime::Span->midpoint method?

Let's wait and see if others ask for it.  For now, let's just add those
recipes to the faq.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to