in reply to Re: Subtracting and Comparing Two Dates
in thread Subtracting and Comparing Two Dates
If I somehow can get date::calc installed could I just then do $diff_in_days = Delta_days($sysdate, $installed_date)? Also in the event I can't install date::Calc can you please give a suggestion of how else to accomplish this?
use POSIX qw(strftime); use Time::Local; #use Date::Calc qw(:all); #use time::Piece; #use Date::Calc qw(Delta_Days); sub give_warning { my($carrier) = @_; my($installed_date); my($max_days) = 15; $installed_date = get_value($carrier ."_DAYS", $trn_info, '') ; printf("Value of Carrier Days is $installed_date \n"); if ($installed_date ne "" ) { my $sysdate = decode_date ('SYSDATE','CCYYMMDD'); printf("Todays date is $sysdate \n"); my $diff_in_days = $sysdate - $installed_date ; print "Difference in days: $diff_in_days\n"; if $result > $max_days # give error and return { &print_error ("New Installation is required."); return 1; } elsif $result <= $max_days # give warning and return { &print_warning ("New Installation is required."); return 0; } } else { return 0; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Subtracting and Comparing Two Dates
by ikegami (Patriarch) on Jan 11, 2007 at 22:45 UTC | |
by mindful07 (Initiate) on Jan 11, 2007 at 23:34 UTC |