Date-Span
view release on metacpan or search on metacpan
lib/Date/Span.pm view on Meta::CPAN
747576777879808182838485868788899091929394
(1 .. (
$end_date
-
$start_date
- 86400) / 86400)
if
(
$end_date
-
$start_date
> 86400);
push
@results
, [
$end_date
,
$end_time
]
if
$start_date
!=
$end_date
;
return
@results
;
}
#pod =func range_expand
#pod
#pod my @endpoint_pairs = range_expand($start, $end);
#pod
#pod Given C<$start> and C<$end> as timestamps (in epoch seconds),
#pod C<range_durations> returns a list of arrayrefs. Each arrayref is a start and
#pod end timestamp. No pair of start and end times will cross a date boundary, and
#pod the set of ranges as a whole will be identical to the passed start and end.
#pod
#pod =cut
sub
range_expand {
my
(
$start
,
$end
) =
@_
;
lib/Date/Span.pm view on Meta::CPAN
238239240241242243244245246247248249250251252253254255256257
my
@durations
= range_durations(
$start
,
$end
)
Given C<
$start
> and C<
$end
> as timestamps (in epoch seconds),
C<range_durations> returns a list of arrayrefs. Each arrayref is a date
(expressed as epoch seconds at midnight) and the number of seconds
for
which
the
given
range intersects
with
the date.
=head2 range_expand
my @endpoint_pairs = range_expand($start, $end);
Given C<$start> and C<$end> as timestamps (in epoch seconds),
C<range_durations> returns a list of arrayrefs. Each arrayref is a start and
end timestamp. No pair of start and end times will cross a date boundary, and
the set of ranges as a whole will be identical to the passed start and end.
=head2 range_from_unit
my ($start, $end) = range_from_unit(@date_unit)
( run in 0.348 second using v1.01-cache-2.11-cpan-e9199f4ba4c )