Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use Date::Calc qw(:all); use strict; my @data_date_confirm=(); my @data_date_birth=(); my $diab_confirm = '29/08/2013'; my $date_birth = '21/02/2013'; if($diab_confirm=~/(\d+)\/(\d+)\/(\d+)/) { my $day_confirm = $1; my $month_confirm = $2; my $year_confirm = $3; @data_date_confirm = ($year_confirm, $month_confirm, $day_conf +irm); } if($date_birth=~/(\d+)\/(\d+)\/(\d+)/) { my $day_birth = $1; my $month_birth = $2; my $year_birth = $3; @data_date_birth = ($year_birth, $month_birth, $day_birth); } my $dd = Delta_Days(@data_date_birth, @data_date_confirm); my $months_until_confirm = sprintf("%.1f", $dd/30); if($months_until_confirm<=6) { print "They are different by more than 6 months!\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: More accurate way to calculate Date difference
by haukex (Archbishop) on Aug 11, 2018 at 08:05 UTC | |
|
Re: More accurate way to calculate Date difference
by hippo (Archbishop) on Aug 11, 2018 at 09:20 UTC | |
|
Re: More accurate way to calculate Date difference
by Athanasius (Archbishop) on Aug 11, 2018 at 07:46 UTC | |
by haukex (Archbishop) on Aug 11, 2018 at 08:18 UTC | |
by Anonymous Monk on Aug 11, 2018 at 08:00 UTC | |
|
Re: More accurate way to calculate Date difference
by choroba (Cardinal) on Aug 11, 2018 at 08:03 UTC |