in reply to time difference in milliseconds

convert both start time and end time to unixtime , use Time::Local.
Take a diff of the unixtime's. Convert the diff back to days, seconds or whatever you want it to.