From: smejmoon@... (G'irts Kalnins) Date: 2004-04-01T01:44:21+09:00 Subject: How to get internal state of DateTime in seconds How do you get internal state in seconds of DateTime instance? Or convert it to Time instance? I want to compare two times with variable precision. Below is my try to parse time from Common Log Format. require 'date' str1 = '20/Nov/2003:08:08:09 +0200' str2 = '20/Nov/2003:08:04:09 +0200' t1 = DateTime.strptime(str=str1, fmt='%d/%b/%Y:%H:%M:%S %Z') t2 = DateTime.strptime(str=str2, fmt='%d/%b/%Y:%H:%M:%S %Z') #what is difference in minutes between these 2 times? #example with Time instances t1 = Time.new t2 = Time.new + 2*60 #2 minutes later puts (t1-t2).abs > 60 #diff more than minute