my requirement is checking the response time of an event:
example:
TimeStamp1- 7/6/2023 1:01:10 AM
TimeStamp2- 7/6/2023 1:15:00 AM
response result should be 00:13:50
i have created a custom function. I am not quite confident on the result. am i doing it right?
is there a simplier function in finding the result
Let([
$startTime = GetAsTime(TimeStamp1);
$endTime = GetAsTime(TimeStamp2);
$timeDiff = GetAsTimestamp($startTime) - GetAsTimestamp( $endTime);
$hours = Floor($timeDiff / 3600);
$minutes = Mod(Floor($timeDiff / 60); 60);
$seconds = Mod($timeDiff; 60);
$formattedTime = Right("0" & $hours; 2) & ":" & Right("0" & $minutes; 2) & ":" & Right("0" & $seconds; 2)
];
$formattedTime
)
I might start with something like the following, and then adapt if I see shortcomings once I start to test it:
GetAsTime( Timestamp2 - Timestamp1 )
I'll note that the above requires that the both of inputs are timestamp data type, and not, for example, strings.
2 Likes
i think the result should be around 00:14:59
Those are not timestamps that you are supplying as inputs; those are literal strings.
Try creating two timestamp fields in a record, and populate them with timestamp data, and then feed those fields into the calculation expression. Once the inputs are actual timestamps, the distinction between feeding in timestamps and literal strings will hopefully be a little more clear.
you are right sir Steve
now i realized that my problem is my a field in my table
thanks a lot
1 Like
There is a relevant post on the Claris Engineering Blog
...that is worth looking at.
1 Like
Great article. Thank you @tonywhitelive