By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,775 Members | 1,740 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,775 IT Pros & Developers. It's quick & easy.

Diffrence between timestamps

P: 51
i have got two timestamps as under:
Expand|Select|Wrap|Line Numbers
  1.  my $time1 = "2008-10-06  11:20:23";
  2. my $time2 = "2008-15-06  12:20:12";
i need to get difference between $time1 and $time2 i.e. i want $time3 should be equal to $time2-$time1. Is there any module to do the same? Please tell me.

Oct 22 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 4,059
Use the Time::Local module to convert the dates into epoch seconds then compute the difference. See the Time::Local modules documentation for details. It is a core module so your installation of perl will have it. If you get stuck after reading the documentation and writing and trying some code, post back.
Oct 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.