Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: TimeDiff Valid Format Date Time YMDHMS
Now both numbers are in the right format YMDHMS, and the first number (A to D) is always going to be higher (therefore later) then the second (B to C). Can anyone shed any light on this? Is it simply that the YMD part of the time has to have numbers?
For Example:
diff1 = TimeDiff (TimeYmdHms(), "1993:10:05:00:00:00") diff2 = TimeDiff (TimeYmdHms(), "2009:02:01:00:00:00") diff3 = TimeDiff (diff1, diff2)... and this too ...diff = TimeDiff("0000:01:01:00:05:32", "0000:01:01:00:03:10")The time calculation begins in year zero, at the first day in January, at hour zero, minute zero, second zero. Here is UDF to force valid datetime strings.#DefineFunction udfTimeDiff (strYmdHms1, strYmdHms2) ; Make valid datetime strings. ;Detlev Dalitz DD.20090611.1800.CEST strYmdHms1 = TimeAdd ("0:1:1", strYmdHms1) strYmdHms2 = TimeAdd ("0: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
Article ID: W18404Filename: Force Valid TimeDiff Strings.txtFile Created: 2009:06:11:10:10:50Last Updated: 2009:06:11:10:10:50