> For the complete documentation index, see [llms.txt](https://docs.cloudfabrix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudfabrix.io/rda/rda-userguide/rda-aiops-studio/examples-jupyter/data-mapping-cfxdm-dm-functions/date-and-timestamp-functions.md).

# Date and Timestamp

### Examples:&#x20;

&#x20;[incidents.csv](https://macaw-amer.s3.amazonaws.com/rda/data/incidents.csv) -- This file contains a set of tickets/incident details

### ts\_to\_datetimestr  -  Parses input timestamp in milliseconds and converts human readable string

Step 1: Create an empty pipeine datetime\_example AIOps studio as shown in the below screenshot

![Empty pipeline creation using AIOps Studio](/files/-MbhHea5H2ZyT6jpSW0O)

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.\
\&#xNAN;*`##### This pipeline creates set of records (ipaddress, timestampin milliseconds,`* \
*`##### id) using AIOps studio.`*\
\
*`##### Using RDA functionality *dm:filter renamed two column names`*\
*`##### ipaddresss to IP_Address, time to Alert_Time`*\
*`##### After renaming is completed, dm:function 'ts_to_datetimestr' is used`*\
*`####  to convert timestamp into human readable format.`*\
&#x20;\
*`@dm:empty`* \
*`--> @dm:addrow ipaddress = '10.10.1.1' & time = '1623193065990' & id = 'a1'`*\
*`--> @dm:addrow ipaddress = '10.10.1.2' & time = '1623193065990' & id = 'a2'`*\
*`--> @dm:addrow ipaddress = '10.10.1.3' & time = '1623193065990' & id = 'a3'`*\
*`--> @dm:addrow ipaddress = '10.10.1.4' & time = '1623193065990' & id = 'a4'`*\
*`--> *dm:filter * get id,ipaddress as 'IP_Address',time as 'Alert_time'`*\
*`--> @dm:map attr = 'Alert_time' & func = 'ts_to_datetimestr' & unit = 'ms'`*

**Note:  ts\_to\_datetimestr parameter unit (from the above) supports "ms, ns,s, excel\_date" formats.**\
\
Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

![Pipeline code and verification of syntax for dm:func 'ts\_to\_datetimestr'](/files/-MbhoOEc6KSZicteEYwA)

Step 4:  Click execute button and execute the pipeline. Once the pipeline is executed, verify data from Alert\_time column that shows human readable time string (as shown in the below screen shot).

![Execute pipeline by clicking 'Execute' button. Above shows sucessful execution](/files/-MbhpJxhUM0A1cUTlTIC)

Step 5:  Verify the data (as shown in the below screenshot)

![](/files/-Mbhr5scz0G9EafY_xCK)

### datetime  -  **Convert Human readable Date & Timestamp to Milliseconds**

Step 1: Create an empty pipeine datetime\_to\_milliseconds\_example

![](/files/-MbhzM0jx2l8zKlirPT9)

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.\
\&#xNAN;*`##### This pipeline creates set of records (ipaddress, timestampin milliseconds,id)`* \
*`##### using AIOps studio.`*\
\
*`##### Using RDA functionality *dm:filter renamed two column names`*\
*`##### ipaddress to IP_Address, timestamp to Timestamp_in_milliseconds`*\
*`##### After renaming is completed, dm:function 'datetime' is used`*\
*`####  to convert timestamp in string format into timestamp in milliseconds`*\
&#x20;\
*`@dm:empty`* \
*`--> @dm:addrow ipaddress = '10.10.1.1' & timestamp = '2021-01-15 03:00:00' & id = 'a1'`*\
*`--> @dm:addrow ipaddress = '10.10.1.2' & timestamp = '2021-01-15 04:00:00' & id = 'a2'`*\
*`--> @dm:addrow ipaddress = '10.10.1.3' & timestamp = '2021-01-15 05:00:00' & id = 'a3'`*\
*`--> @dm:addrow ipaddress = '10.10.1.4' & timestamp = '2021-01-15 06:00:00' & id = 'a4'`*\
*`--> *dm:filter * get id,ipaddress as 'IP_Address',timestamp as 'Timestamp_in_milliseconds'`*\
*`--> @dm:map attr = 'Timestamp_in_milliseconds' & func = 'datetime'`*<br>

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

![Pipeline code snippet validation ](/files/-Mbi1AptnUuQC_iAmkM3)

Step 4:  Click execute button and execute the pipeline. Once the pipeline is executed, verify data from Alert\_time column that shows human readable time string (as shown in the below screen shot).

![Successful execution of pipeline code](/files/-Mbi1tRheKPwTeNejZqj)

Step 5:  Verify the data (as shown in the below screenshot)

![](/files/-Mbi2RzytRK7yCbfSHji)
