--- title: "YMDH(A)" slug: "datetimetransform-template-10" updated: 2021-11-16T14:59:34Z published: 2021-11-16T14:59:34Z canonical: "docs.datajet.app/datetimetransform-template-10" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # YMDH(A) ## DateTime Transform: YMDH(A) ## Returns Year Month Day Hour of DateTime A in the format YYYYMMDDHH ## Purpose Use this function to: - Create a discrete DataType from a continuous DateTime field ready for use in further engineering and analytical operations. ## Return Value | Property | Value | | --- | --- | | **FieldType** | Integer | | **FieldSize** | Low / Med / High | | **DataType** | Discrete | | **DataSize** | Short / Integer | ```shell Example Return Value: YYYYMMDDH: 2020010101....2020010119.... ``` ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/DT_YMDH_Sample.PNG) ## Parameters | Parameter | JSON | Description | | --- | --- | --- | | **Table** | “targetTable”: “MyTableName” | The target table on which the new field will be created | | **Filter** | “dataset”: {DataSet_JSON} | Optional. If a filter is applied, records not in the filter Recordset will be returned as null. | | **DateTime Function** | “p1”: “” | | | **A** | “p2”: “DateTimeFieldName” “p2”: “#YYYY-MM-DD HH:MM:SS” | Required. DateTime string from which to extract Year Month Day Hour *Supports:* - **DataType:** Discrete / Continuous - **Field Type:** DateTime - ****Fixed Value:** #YYYY-MM-DD HH:MM:SS, e.g. #2021-04-05 11:01:08** | ## JSON Sample ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/DT_YMDH_JSON.PNG) ## Usage Notes To create discrete DataTypes that retain minute and second granularity, considering creating an ElapsedMins or ElapsedSecs field using MINSDIFF(A,B) or SECSDIFF(A,B), where A = DateTime Field and B = Min(A) ## Example | Example | Details | | --- | --- | | **Description** | Create Year Month Day Hour | | **Input** | - Table: = [transactions] - Function: = DateTimeTransform - **DateTimeFunction: =** - A:= [transactions].[dtPurchase] - Name: =YMDH_A | | **Sample** | ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/DT_YMDH_Example.png) |