⭐ in reply to How do I find the difference in days between two dates, in a cool perl way?
The int() there, by the way, chops off the decimal so you don't end up with something like 4.3231235. If you're curious, the remainder of that division is the number of seconds left after finding the number of days, so if you want "x days, x hours", you can do this next:my $days_difference = int(($time1 - $time2) / 86400);
That should give you an idea. If your dates aren't in epoch seconds, you'll either have to get them there somehow, or check out one of the Date::* modules.my $hours_left = int((($time1 - $time2) % 86400) / 3600);
|
|---|