I'm not sure where to start so I will start at the beginning. I have two lists containing two columns each. A date/time column and a number column in the following format:

```
2012-11-27 13:16:19.473           6
2012-11-27 13:17:17.910         710
2012-11-28 15:21:52.513         696
2012-11-29 08:40:16.430         541
2012-11-20 09:07:45.813         347
2012-12-01 01:00:09.230         647
2012-12-01 14:53:22.200         488
2012-12-04 18:42:02.727         797

```

The date/times are always unique but the 2nd column has duplicates in both lists. I first need to compare the 2nd column of the first list to the 2nd column of the second list. Each time a match is found in the second column I need to compare the corresponding dates. If the dates are within (+ or -) 5 days of each other I need to subtract them and find the difference in hours, then count how many occurrences of each difference there is.

For example:

List 1:

```
2014-03-27 17:00:00.000         582
2012-12-04 18:42:02.727         797

```

List 2:

```
2014-03-28 17:00:00.000         582
2012-12-04 18:42:02.727         793

```

The required output would be 1 occurrence of 24 hours.

I'm unsure as to the best way to store the lists which are coming out of a database. Hashes with the date as the key because the 2nd column has duplicates or arrays or arrays of arrays or... help me!

Thank you!