How to subtract dates from each other
问题 I am using Groovy. I have parsed a textfile whose lines contain information, including dates. I now have just the dates, for example: 08:13:16,121 09:32:42,102 10:43:47,153 I want to compare the deltas between these values; how can I do this? i.e, I want to subtract the first from the second, and compare that value to the difference between the third and the second. I will save the largest value. 回答1: Assuming your times are in a file times.txt , you can do this: def parseDate = { str -> new