OK I fixed the "bad date format string" error - it WAS to do with null values. Here's a different problem.
using this forum, I found the following formula:
numberVar dur := 999; //replace the 999 with your field.
numberVar days;
numberVar hrs;
numberVar min;
stringVar result;
days := Truncate(dur/480);
hrs := Truncate(Remainder(dur,480)/60);
min := Remainder(Remainder(Remainder(dur,480),60),60);
result := totext(days, "0") + " d, " + totext(hrs, "0") + " h, " + totext(min,"0") + " m";
result
I need to use this formula, as I have a field which contains minutes, which I need to convert to days, hours and minutes.
The field that contains the minutes is derived from the following formulas:
@{Date Received}
datetime(date({CallLog.RecvdDate}) & " " & time({CallLog.RecvdTime}))
@Date Acknowledged
datetime(date({Asgnmnt.DATEACKNOW}) & " " & time({Asgnmnt.TIMEACKNOW}))
@{Difference between Rec and Ack in MINUTES}
datediff("n",{@DT Received},{@DT Acknowledged})
I then place the above formula in the conversion formula that I retrieved from this forum.
I get the following results:
Call ID Call Type Status Date Received Date Acknowledged Minutes Conversion
61294 Software Closed 05/01/2004 11:42 07/01/2004 14:23 3041 6 d, 2 h, 41 m Wrong
61329 Hardware Open 06/01/2004 09:17 07/01/2004 14:23 1746 3 d, 5 h, 6 m Wrong
61366 Telephone Closed 06/01/2004 12:18 07/01/2004 11:30 1392 2 d, 7 h, 12 m Wrong
61373 Software Closed 06/01/2004 13:12 07/01/2004 09:16 1204 2 d, 4 h, 4 m Wrong
61375 Software Closed 06/01/2004 14:09 07/01/2004 15:05 1496 3 d, 0 h, 56 m Wrong
61376 Software Closed 06/01/2004 14:09 07/01/2004 09:23 1154 2 d, 3 h, 14 m Wrong
61385 Software Closed 06/01/2004 15:21 07/01/2004 09:22 1081 2 d, 2 h, 1 m Wrong
61387 Software Closed 06/01/2004 15:33 07/01/2004 12:13 1240 2 d, 4 h, 40 m Wrong
61389 Software Closed 06/01/2004 15:45 07/01/2004 09:27 1062 2 d, 1 h, 42 m Wrong
61392 Software Closed 06/01/2004 16:08 07/01/2004 09:17 1029 2 d, 1 h, 9 m Wrong
61394 Telephone Closed 06/01/2004 16:23 07/01/2004 09:09 1006 2 d, 0 h, 46 m Wrong
61396 Software Closed 06/01/2004 16:35 07/01/2004 15:11 1356 2 d, 6 h, 36 m Wrong
61401 Request Closed 07/01/2004 08:53 07/01/2004 09:11 18 0 d, 0 h, 18 m Correct
61402 Telephone Closed 07/01/2004 09:02 07/01/2004 09:02 0 0 d, 0 h, 0 m Correct
61408 Software Closed 07/01/2004 09:45 07/01/2004 11:40 115 0 d, 1 h, 55 m Correct
61409 Printing PC Closed 07/01/2004 09:47 07/01/2004 11:47 120 0 d, 2 h, 0 m Correct
61417 Software Closed 07/01/2004 10:55 07/01/2004 11:38 43 0 d, 0 h, 43 m Correct
61422 Printing Closed 07/01/2004 11:14 07/01/2004 12:20 66 0 d, 1 h, 6 m Correct
61425 Request Closed 07/01/2004 11:40 07/01/2004 11:42 2 0 d, 0 h, 2 m Correct
61426 Request Closed 07/01/2004 11:42 07/01/2004 11:43 1 0 d, 0 h, 1 m Correct
61428 Software Closed 07/01/2004 12:40 07/01/2004 12:41 1 0 d, 0 h, 1 m Correct
61429 Software Closed 07/01/2004 12:50 07/01/2004 14:13 83 0 d, 1 h, 23 m Correct
61433 Software Closed 07/01/2004 14:37 07/01/2004 14:59 22 0 d, 0 h, 22 m Correct
I don't understand why some work fine, and some don't. It looks like it works fine when the number of minutes are within the same day, but as soon as the date changes, the conversion spews out random days, hours and minutes, and so does the datediff formula.
Help anyone?
using this forum, I found the following formula:
numberVar dur := 999; //replace the 999 with your field.
numberVar days;
numberVar hrs;
numberVar min;
stringVar result;
days := Truncate(dur/480);
hrs := Truncate(Remainder(dur,480)/60);
min := Remainder(Remainder(Remainder(dur,480),60),60);
result := totext(days, "0") + " d, " + totext(hrs, "0") + " h, " + totext(min,"0") + " m";
result
I need to use this formula, as I have a field which contains minutes, which I need to convert to days, hours and minutes.
The field that contains the minutes is derived from the following formulas:
@{Date Received}
datetime(date({CallLog.RecvdDate}) & " " & time({CallLog.RecvdTime}))
@Date Acknowledged
datetime(date({Asgnmnt.DATEACKNOW}) & " " & time({Asgnmnt.TIMEACKNOW}))
@{Difference between Rec and Ack in MINUTES}
datediff("n",{@DT Received},{@DT Acknowledged})
I then place the above formula in the conversion formula that I retrieved from this forum.
I get the following results:
Call ID Call Type Status Date Received Date Acknowledged Minutes Conversion
61294 Software Closed 05/01/2004 11:42 07/01/2004 14:23 3041 6 d, 2 h, 41 m Wrong
61329 Hardware Open 06/01/2004 09:17 07/01/2004 14:23 1746 3 d, 5 h, 6 m Wrong
61366 Telephone Closed 06/01/2004 12:18 07/01/2004 11:30 1392 2 d, 7 h, 12 m Wrong
61373 Software Closed 06/01/2004 13:12 07/01/2004 09:16 1204 2 d, 4 h, 4 m Wrong
61375 Software Closed 06/01/2004 14:09 07/01/2004 15:05 1496 3 d, 0 h, 56 m Wrong
61376 Software Closed 06/01/2004 14:09 07/01/2004 09:23 1154 2 d, 3 h, 14 m Wrong
61385 Software Closed 06/01/2004 15:21 07/01/2004 09:22 1081 2 d, 2 h, 1 m Wrong
61387 Software Closed 06/01/2004 15:33 07/01/2004 12:13 1240 2 d, 4 h, 40 m Wrong
61389 Software Closed 06/01/2004 15:45 07/01/2004 09:27 1062 2 d, 1 h, 42 m Wrong
61392 Software Closed 06/01/2004 16:08 07/01/2004 09:17 1029 2 d, 1 h, 9 m Wrong
61394 Telephone Closed 06/01/2004 16:23 07/01/2004 09:09 1006 2 d, 0 h, 46 m Wrong
61396 Software Closed 06/01/2004 16:35 07/01/2004 15:11 1356 2 d, 6 h, 36 m Wrong
61401 Request Closed 07/01/2004 08:53 07/01/2004 09:11 18 0 d, 0 h, 18 m Correct
61402 Telephone Closed 07/01/2004 09:02 07/01/2004 09:02 0 0 d, 0 h, 0 m Correct
61408 Software Closed 07/01/2004 09:45 07/01/2004 11:40 115 0 d, 1 h, 55 m Correct
61409 Printing PC Closed 07/01/2004 09:47 07/01/2004 11:47 120 0 d, 2 h, 0 m Correct
61417 Software Closed 07/01/2004 10:55 07/01/2004 11:38 43 0 d, 0 h, 43 m Correct
61422 Printing Closed 07/01/2004 11:14 07/01/2004 12:20 66 0 d, 1 h, 6 m Correct
61425 Request Closed 07/01/2004 11:40 07/01/2004 11:42 2 0 d, 0 h, 2 m Correct
61426 Request Closed 07/01/2004 11:42 07/01/2004 11:43 1 0 d, 0 h, 1 m Correct
61428 Software Closed 07/01/2004 12:40 07/01/2004 12:41 1 0 d, 0 h, 1 m Correct
61429 Software Closed 07/01/2004 12:50 07/01/2004 14:13 83 0 d, 1 h, 23 m Correct
61433 Software Closed 07/01/2004 14:37 07/01/2004 14:59 22 0 d, 0 h, 22 m Correct
I don't understand why some work fine, and some don't. It looks like it works fine when the number of minutes are within the same day, but as soon as the date changes, the conversion spews out random days, hours and minutes, and so does the datediff formula.
Help anyone?