in reply to Elapsed date and time

It would help immensely (to help you) if you post some sample data that you are trying to parse, and not create a HTML paragraph every one-and-a-half sentences.

By the way, there are 3600 seconds in an hour not 360, unless your comment has a typo...

... } # I could use: $stime = ($datetemp[3] * 360) + ($datetemp[4] +* 60) # <-- convert to seconds ...

And since you are repeating the algorithm to generate $stime and $etime, why not create a sub so that you do not have to repeat the same 9-12 lines.

As to your problem, cause is obvious. You are using only the the hours, minutes (and seconds); you NEED to consider the day-of-the-month, month, and year. To calculate elasped time properly, you need to, for start and end time,...

  1. extract all five (six) date/time values
  2. convert them to the appropriate lowest unit of time measurement
  3. take the difference as you are already doing


...you can either create your own algorithm (which i prefer for myself) or use module(s)...