I have a function I'm trying to re-create using the DateTime module in Perl:
$x=dates_difference($year,$month,$day,$cyear,$curmon,$cmday)
given two dates, the current date/time in the format of: $cyear, $cmon, $cmday (year, month number, day of month number) and another date that will be earlier in the same format: $year, $month, $day, I want to return the number of days between the two dates. I don't need it to be 100% precise, as long as it's +/- a day or two so time and timezones don't really matter.
I've been reading through various examples and can't find anything very clear.
I tried this:
$x = $dtcurrent->subtract_datetime_absolute($dt1);
and got an error DateTime::Duration does not overload comparison. See the documentation on the compare() method for details.
Example:
$x = $dtcurrent->delta_days($dt1);
if ($x > 30) ...
it does not appear to be returning a number I can use in a numeric comparison.