I was trying to write a code where the inputs are strings like this 16:15 and 16:40 as en example and i want my program to store the difference 25 in a variable. After this is executed the program will take in another 2 values like 05:40 11:30 and add the difference to the previous 25 to give me 6:15. Im thinking of treating the strings with substr and extracting the numbers before the : and after the :. Then storing them in some dummy variables do some calculations then use % to return to usual notation. My question is, is there any other , possibly easier way of doing this. Thank you.