There are many modules and Perl functions that deal with dates. In the easiest case, each date is converted to a number of "epoch" seconds, since Jan 1, 1970 for Unix. Life is easy if both dates are after that date and both dates are calculated in UTC (basically GMT) which is in the same time zone. There are ways to deal with other dates.
Look at: date time perhaps or use the Perl time functions Getting started with DateTime Many variants of these functions are available. Also see http://perldoc.perl.org/Time/Local.html