works fine for me here in Costa Rica, which is GMT -6
EDIT: the Duration method returns a duration in milliseconds. The problem occurs after using the FormatDateTime method together with that duration, because that method expects an instant and not a duration.
Thank you for this proposal but it does not work for me (the proposed file) I still have this problem of 01:00:00 with the companion or APK ?? !!!
I tried to switch my tablet to GMT -6 and there I have 06:00:00
as proof, that it does not work for you, what about providing a screenshot of your relevant blocks including Do it results?
see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
Hello,
I got the wrong archive in my previous answer, disregard it.
For the example proposed, it is complicated to display the result of the blocks because as it is local variables, the do it does not work … (or I do it wrong).
In any case when I click on btn lap:
I have the duration in milliseconds displayed.
By cons for the time above (label 1) I have results H: M: S like 00:13:99
00:14:72 but actually the 01 o’clock has given way to 00!
Ced
Taifun’s advice is correct, you need to convert with quotients and not use any clock conversion blocks.
Just to demonstrate what is happening here, when you seek to convert a millisecond value generated by calculating the difference between two dates, then seek to format it using clock blocks, this will convert the smaller millisecond value to an instant. A few seconds only will be starting from the beginning of the epoch (unix time) 01/01/1970. This instant has a ZONE_OFFSET of 3600000 which adds the hour to the formatted time.
Hello and thank you for your information.
I offer you in solution a block that I found which helped me to finally understand this operation. (convert Milli to seconds befor ! or change init local Sec to sec*1000)
As a bonus, a block to convert to KM / H … if it helps people.