in reply to Calculate difference between multiple days
I just guess you want the maximum difference in a set; if so you can sort by epoch and take first and last one:
use strict; use warnings; use Date::Calc qw(:all); my @array1 = (2018,04,11,0,0,0); my @array2 = (2018,04,12,0,0,0); my @array3 = (2018,04,13,0,0,0); my @ordered = sort { Mktime(@{$a})<=> Mktime(@{$b})} \@array1,\@array2 +,\@array3; print "@$_\n" for @ordered; my $dd = Delta_Days(@{@ordered[0]}[0..2],@{@ordered[-1]}[0..2]); print "Max delta is $dd day(s)\n"; #OUTPUT 2018 4 11 0 0 0 2018 4 12 0 0 0 2018 4 13 0 0 0 Max delta is 2 day(s)
If not, please explain your question more verbosely
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Calculate difference between multiple days
by Anonymous Monk on Oct 25, 2018 at 09:59 UTC | |
by hippo (Archbishop) on Oct 25, 2018 at 10:10 UTC |