> 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/datetime.md).

# Datetime

**Datetime**\
Parses input string and converts into an epoch milliseconds format number. \
Input must be a string. \
@param tzmap: type dict (optional). Dictionary of timezone mappings from custom/local to standard timezones. \
@param expr: type string (optional). A custom timestamp format with UTC/local timezone.\
\
This function can be used when the datasets needs date time conversion to milliseconds or other local timezone format.

### Example 1:&#x20;

Step 1: Create an empty **datetime\_example\_1** using AIOps studio as shown in the below screenshot. 

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

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 a dataset row using current year.`*\
*`##### dm function datetime is used to convert year data into milliseconds`* \
\
*`@dm:empty`* \
*`--> @dm:addrow Year_To_Epoch_MS = '2021'`* \
*`--> @dm:addrow Year_To_Epoch_MS = '2031'`* \
*`--> @dm:map attr = 'Year_To_Epoch_MS' & func = 'datetime'`*<br>

![Pipeline code added to empty pipeline created](/files/-MeW3FpMxfAo98ZKA1WD)

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

![Pipeline code is verified using 'Verify' button as shown above.](/files/-MeW3fKQR4FGx5vhtyeU)

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

![Successful execution of pipeline without any errors.](/files/-MeW446TwNs6_WkQ_btI)

Step 5: RDA uses the dm function datetime to convert year in string format to milliseconds format.\
&#x20; This function will be useful when the dataset contains year(s) as column values and needed to convert to milliseconds for further time calculations.

![Successful execution of pipeline using dm function 'datetime' and prints output ](/files/-MeW58GR2PXdYxuTczqz)
