Substract time

Hi all,

Could You, please, tell me how I can substract or add two variables in format HH:mm:ss (time)? That it would be correct…
Now I am doing:
Time -> “tokenize” delim( : ) -> TimeList
Time2 -> “tokenize” delim( : ) -> TimeList2

Substract Ints: TimeList[0]-TimeList2[0], …[1]-…[1], …[2]-…[2] = result Time. But I don’t think this one correct.

Thank You for all information,

Hi, did you try with PSUtilities.date:calculateDateDifference service? Maybe this service be useful for you.
Regards.

Either use the above suggested psutilities service or write your own piece of java code, its quite easy to achive time substraction/addition in java.

Hi,
I just want to wrote. Sorry, only now I found Your answers.
So, I wrote by myself - not in Java, but in WebMethods.

Service:

  1. Two times at input;
  2. Tokenize both to HH, mm, ss;
  3. Substract each part;
  4. Branch if ss or mm with “-”;
  5. Concat theese parts with " : ".

CAS975
Thanks for Your help - I think I should try this service. Just for my knowledge :slight_smile: