you get 2 timestamps, with the result being the number of seconds difference, then you use it as a timestamp, which, based on your time difference, is the hour of that timestamp, back in 1970 or whenever.
you'll need to write a secondsToString() type function that divides by 60 for minutes, and shows teh remainder as seconds. You can also make it calculate hours, days, weeks, etc also. (months would be based on an average month length, same for years)