Looking for a bit of help with time calculations. I’m using the API connector to get live train times which returns scheduled arrival and actual arrival time at a specified station as text.
I’m trying to display the delay time in minutes by calculating the difference between the two values. So far I have got a dynamic text box with (Actual Arrival:converted to number - Scheduled Arrival:converted to number)
This works fine if the actual and scheduled are within the same hour, however, if for example the actual arrival is 1710 and scheduled is 1650, the result is 60 obviously as it thinks we’re working with numbers rather than time.
Is there a way to convert the text to a time value so the calculation is correct? Or am I over complicating it?
Wow, that’s a frustrating format from an API. Here’s how you could do it:
current date/time :change hours to {Actual Arrival :truncated to 2 :converted to number} change minutes to {Actual Arrival :truncated from end to 2 :converted to number} - current date/time :change hours to {Scheduled Arrival :truncated to 2 :converted to number} change minutes to {Scheduled Arrival :truncated from end to 2 :converted to number}
Thanks both for your replies, I’ve given this one a go, I get as far as the second current date/time and it won’t let me do change hours. Apologies if I’m doing something wrong, I’m very much a beginner to this.
You are one click away from it working. Just click the “Formatted as minutes” and you’ll get the difference between the time you generated with truncating stuff and the current time.