Have a look at Date::Calc at CPAN.
In reply to Re: how to get the time difference by Crian in thread how to get the time difference by arunmep