--- title: "DateFromString" slug: "datefromstring" updated: 2023-03-24T14:38:15Z published: 2023-03-24T14:38:15Z canonical: "docs.datajet.app/datefromstring" --- > ## 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. # DATEFROMSTRING(A,B) ## String: DateFromString(A,B) ## Produce a date field from a date stored as string ## Purpose Use this function to: - Convert Dates loaded as strings into Date fields - Create Date fields after loading unknown date columns as strings for inspection and review ## Return Value | Property | Value | | --- | --- | | **FieldType** | Date | | **FieldSize** | Low / Med | | **DataType** | Discrete | | **DataSize** | Integer | ```shell Example Return Value: 1974-02-19 ``` ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1679668599452.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. | | **Function** | "function":"String" | String | | String Function | “p1”: “DATEFROMSTRING(A,B)” | DATEFROMSTRING(A,B) | | A | “p2”: | Required. The string field containing the date string *Supports:* - **DataType:** Discrete / Continuous - **Field Type:** String - **Fixed Value:** #YYYY-MM-DD etc | | B | “p3”: | Required. The format of the data in the source string field *Supports:* - #YYYY-MM-DD - #YYYYMMDD - #MM-DD-YYYY - #MMDDYYYY - #DD-MM-YYYY - #DDMMYYYY | | **Treat Null as Zero** | "nullIsZero": true "nullIsZero": false | True/False. Default = False If true, then any null values in the input fields will be treated as if they have a value of 0. | ## JSON Sample ```json { "method": "BuildBakedField", "project": "BikeData2", "targetTable": "BikeTripData", "overwrite": true, "name": "dt_start_date", "function": "string", "p1": "DATEFROMSTRING(A,B)", "p2": "str_start_date", "p3": "#YYYY-MM-DD" } ``` ## Usage Notes Convert date values stored in STRING field into a native DATE field Inputs: - Field A is the string date - Field B is the string date format Date Formats: - #YYYY-MM-DD - #YYYYMMDD - #MM-DD-YYYY - #MMDDYYYY - #DD-MM-YYYY - #DDMMYYYY See Also: - Engineering | Expression Field ## Example | Example | Details | | --- | --- | | **Description** | Create date field from date loaded as a string | | **Input** | - Table: = [BikeTripData] - Filter: = [No Filter] - **Function: = String** - String Function:= DATEFROMSTRING(A,B) - A: = str_start_date - B: = #YYYY-MM-DD - Name: =dt_start_date | | **Sample** | ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1679668342866.png) |