#DefineFunction udfTimeDiff (strYmdHms1, strYmdHms2) ; Make valid datetime strings. strYmdHms1 = TimeAdd ("0000:1:1", strYmdHms1) strYmdHms2 = TimeAdd ("0000:1:1", strYmdHms2) ; Compare datetime strings. If strYmdHms1 > strYmdhms2 Then Return TimeDiff (strYmdHms1, strYmdhms2) Return TimeDiff (strYmdHms2, strYmdhms1) #EndFunction ; Test. strYmdHms1 = "0:0:0:0:5:32" strYmdHms2 = "0:0:0:0:3:10" strYmdHmsDiff1 = udfTimeDiff (strYmdHms1, strYmdHms2) ; "0000:00:00:00:02:22" strYmdHmsDiff2 = udfTimeDiff (strYmdHms2, strYmdHms1) ; "0000:00:00:00:02:22" Exit