In my application I have php script running on server which returns a date time in the format "yyyy-mm-dd hh:mm:ss" is there any way to find the duration between this and the current time via clock?
How do you check difference between DateTime string coming from SQL php and current time from clock in MIT app inventor?
You have to convert date to MM/DD/YYYY hh:mm:ss format. You can create a procedure for that like (blocks are draggable)
and then get difference in millis. In below example I use [FREE] Time Format Extension - Millis to [HH:mm:ss] - [days + HH:mm:ss] - [HH:mm] - [mm:ss] etc to get duration
- change all / and - to blanks to get only blank delimiters (two chained replace text blocks)
- split the resultant text at blanks to get a list of datetime parts in descending order of magnitude (one block)
- Feed the 6 datetime parts into parameters of the Clock block that builds an Instant from parts
- Take Duration between Clock1.Now() and your Instant