And from the recipes section of the documentation ...
1) How do I compare two dates? Solution #1: use Date::Calc qw( Date_to_Days ); if (Date_to_Days($year1,$month1,$day1) < Date_to_Days($year2,$month2,$day2)) if (Date_to_Days($year1,$month1,$day1) <= Date_to_Days($year2,$month2,$day2)) if (Date_to_Days($year1,$month1,$day1) > Date_to_Days($year2,$month2,$day2)) if (Date_to_Days($year1,$month1,$day1) >= Date_to_Days($year2,$month2,$day2)) if (Date_to_Days($year1,$month1,$day1) == Date_to_Days($year2,$month2,$day2)) if (Date_to_Days($year1,$month1,$day1) != Date_to_Days($year2,$month2,$day2)) $cmp = (Date_to_Days($year1,$month1,$day1) <=> Date_to_Days($year2,$month2,$day2)); Solution #2: use Date::Calc qw( Delta_Days ); if (Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) > 0) if (Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) >= 0) if (Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) < 0) if (Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) <= 0) if (Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) == 0) if (Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) != 0)
This module is definitely worth spending some time investigating and experimenting with.
Ooohhh, Rob no beer function well without!
In reply to Re: Date Comparison..?
by rob_au
in thread Date Comparison..?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |