2009/4/8 Rick Measham <ri...@isite.net.au>:
> Sounds like a job for DateTime::Format::MySQL ..
>
> $span = DateTime::Span->from_datetimes( start => $dt1, end => $dt2 );
> print DateTime::Format::MySQL->format_span( $span, 'colname' );
> # colname >= '2009-04-08 23:22:00' AND colname <= '2009-04-09 23:22:00'
[...]
> And could be extended to SpanSets too:
> $spanset = DateTime::SpanSet->from_spans( spans => [ $dt_span, $dt_span ] );
> # (colname >= '2009-04-08 23:22:00' AND colname < '2009-04-09 23:22:00') OR
> (colname >= '2009-05-08 23:22:00' AND colname < '2009-05-09 23:22:00')
>
> (Of course, this couldn't be expected to work on infinite or even large
> spansets)

Good idea!

Please use 'format_period' instead of 'format_span' - format_period()
is used by DateTime::Format::ICal API.

format_recurrence() is doable too. DateTime::Event::Recurrence stores
some hints that make stringification possible in several cases.

- Flavio S. Glock

Reply via email to