Compare 2 dates

Hello,

First of all, all my apologies for my english speaking.

I have a question for you guys, please help.
I’m monitoring a batch : I have 2 timestamp (when the batch starts and when it ends).

I would like to get the differente between the two to see how the batch lasted.

Can you help me please ?

Thank you very much

you could use a processing pipeline rule like:

rule "calc_processing_time"
when
  // REQUESTTIME Format hh:mi:ss.mmm
  has_field("REQUESTTIME") AND
  // RESPONSETIME Format hh:mi:ss.mmm
  has_field("RESPONSETIME")
then
    // the math of RESPONSETIME minus REQUESTTIME
    // translated to milliseconds
    set_field( "processing_time", parse_date(
    				value: to_string($message.RESPONSETIME), 
    				pattern: "HH:mm:ss.SSS", 
    				locale:"en" ).millis - parse_date(
    						value: to_string($message.REQUESTTIME),
    						pattern: "HH:mm:ss.SSS", 
    						locale:"en" ).millis );
end

The above is not tested, but should work with a little adjustments.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.