Ts_To_Datetimestr
Ts_To_Datetimestr Processes input number with specified 'unit' (s, ms, ns, excel_date) and converts the value to datetime string specified by 'format', default is ISO format. Input must be a float or int. @param 'unit' (Type string), must be s,ms,ns,excel_date, default is 'ms' @param 'format' (Type string), default is None (ISO format) This function is useful in case users want to convert to proper date-time strings.
Example 1:
Step 1: Create an empty ts_to_datetimestr_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 dataset row using current time in milliseconds.
##### dm function ts_to_datetimestr is used to convert string data into proper
##### date time string using ISO format (default). This function takes an additional
##### parameter unit using 'ms', 's'.
@dm:empty
--> @dm:addrow Time_in_Milliseconds = '1626147743837'
--> @dm:map to = 'Time_in_String' & from = 'Time_in_Milliseconds' & func = 'ts_to_datetimestr' & unit = 'ms'
--> *dm:filter * get Time_in_String
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 ts_to_datetimestr to convert milliseconds into readable string format using ISO format as shown below. This function will be useful when the dataset contains timestamps in ms, s, excel_date that need to be converted to string format for reporting purposes.
Last updated