Hello,
Due to InfoPath not being able to add/subtract time out of the box, I spent multiple hours figuring out how to subtract start and end time. So now I have a result formatted as string, but I want to ROUND UP to the nearest hour. So for 00:25 I want it rounded to 01:00, and 01:40 to 02:00, etc. Then I need the sum of this result (they are in a repeating table). With the results formatted as a string, I don't imagine I can using the Ceiling function...
Here is what I've done to create the Elapsed_Time
concat(substring(concat(substring-before(../my:Total_Minutes div 60, "."), ":", ../my:Total_Minutes mod 60), 1, contains(../my:Total_Minutes div 60, ".") * string-length(concat(substring-before(../my:Total_Minutes div 60, "."), ":", ../my:Total_Minutes mod 60))), substring(concat(../my:Total_Minutes div 60, ":", ../my:Total_Minutes mod 60), 1, not(contains(../my:Total_Minutes div 60, ".")) * string-length(concat(../my:Total_Minutes div 60, ":", ../my:Total_Minutes mod 60))))
Using the Total_Minutes field
substring(((substring-before(../my:End_Time, ":") * 60) + substring-before(substring-after(../my:End_Time, ":"), ":")) - ((substring-before(../my:Start_Time, ":") * 60) + substring-before(substring-after(../my:Start_Time, ":"), ":")), 1, (../my:Start_Time != "" and ../my:End_Time != "") * string-length(((substring-before(../my:End_Time, ":") * 60) + substring-before(substring-after(../my:End_Time, ":"), ":")) - ((substring-before(../my:Start_Time, ":") * 60) + substring-before(substring-after(../my:Start_Time, ":"), ":"))))