Diffrence between timestamps

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pavanponnapalli
    New Member
    • May 2008
    • 51

    Diffrence between timestamps

    hi,
    i have got two timestamps as under:
    Code:
     my $time1 = "2008-10-06  11:20:23";
    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.

    Regards,
    Pavan
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    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.

    Comment

    Working...