Seconds_Between

The number of seconds between two date-time strings. If only one is specified, it compares the difference between it and the current timestamp.

Example 1:

Step 1: Create an empty seconds_between_example_1 using AIOps studio as shown in the below screenshot. 

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment. ##### This pipeline creates a simple time fields time1 and time2 with two distinctive ##### values as a dataset. ##### Pipeline uses RDA dm function seconds_between to calculate seconds between two ##### timestamps and prints the value. In addition, RDA dm function ts_to_datetimestr ##### is used to convert the the time difference into string (other units are ms,ns, ##### excel_date) @dm:empty --> @dm:addrow time1 = 1623193065990 & time2 = 1623193085990 --> @dm:map to = 'Change_In_Seconds' & from = 'time1,time2' & func = 'seconds_between' --> @dm:map attr = 'Change_In_Seconds' & func = 'ts_to_datetimestr' & unit = 's'

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

Step 5: RDA uses the dm function seconds_between to calculate the difference between two timestamps and presents the output as shown below screenshot. Note: In addition to the above dm function, the pipeline also uses ts_to_datetimestr to convert the timestamp value to a string.

Last updated