The Create date time tool creates a date field using existing field values.
Examples
The Create date time tool can be used in scenarios such as the following:
- A hurricane tracking dataset contains a string representation of the observation time. Use the Create date time tool to format and output the string field as a date field.
- A dataset stores time information across the Hour, Minute, and Second fields. Use the Create date time tool to specify these fields and the formats of the field values to create a new date field.
Parameters
The following table outlines the parameters used in the Create date time tool:
Parameter | Description |
---|---|
Input dataset | The dataset containing the field values that will be used to create the date field. |
Fields | A list of one or more fields and the format of the date or time values contained in the specified field. |
Time field | A field containing date or time values. |
Time format | The format of the values in the time field. |
Keep source fields | Specifies whether the fields used to create a date will be maintained in the output. |
Time zone | The time zone of the input values. |
Output time field name | The name of the output time field. This is an optional parameter. The default value is TIMESTAMP. |
Usage notes
Use the Input dataset parameter to identify the dataset containing the field values that will be used to create the date field. The dataset will be returned in the output with the new date column added.
Use the Fields parameter to specify one or more fields to calculate the output date values. The output is a single date field. The following are examples of input fields and formats:
- You have a string field named MY_DATE_TIME with a value of 2022-12-30 17:30:00. Specify MYDATETIME for the time field and a value of yyyy-MM-dd HH:mm:ss for the time format.
- You have two fields: MY_DATE with a value of 07/25/2000 and MY_TIME with a value of 5:30:00 PM. Specify two field and format pairs. Specify the first time field as MY_DATE with a format value of MM/dd/yyyy, and the second time field as MY_TIME with a format value of hh:mm:ss a.
By default, the fields used to create the date will be removed from the output dataset. To maintain the input fields, enable the Keep source fields parameter.
The Time zone parameter indicates the time zone where the input time values are stored. The default value is coordinated universal time (UTC). If you specify a value other than UTC, the input values will be calculated using the specified time value, but the output time field will be converted to UTC.
Time zones are based on Joda-Time. To learn more about Joda-Time formats, see Joda-Time Available Time Zones.
Time formats in Data Pipelines
Value | Description | Example |
---|---|---|
yy | The year, represented by two digits. | 16 |
yyyy | The year, represented by four digits. | 2016 |
MM | The month, represented numerically. | 01 or 1 |
MMM | The month, represented using three letters. | Jan |
MMMM | The month, represented using the complete spelling. | January |
dd | The day. | 02 or 2 |
HH | The hour when using a 24-hour day; values range from 0 to 23. | 21 |
hh | The hour when using a 12-hour day; values range from 1 to 12. | 9 |
mm | The minute; values range from 0 to 59. | 45 |
ss | The second; values range from 0 to 59. | 02 |
SSS | The millisecond; values range from 0 to 999. | 50 |
a | The AM/PM marker. | PM |
epoch_millis | The time in milliseconds from epoch. | 1509581781000 |
epoch_seconds | The time in seconds from epoch. | 1509747601 |
Z | The time zone offset expressed in hours. | -0100 or -01:00 |
ZZZ | The time zone offset expressed using IDs. | America/Los_Angeles |
'' | Single quotes add text that doesn't represent a value outlined in this table. | 'T' |
Outputs
The tool creates a single date field. All of the time field and format pairs you specify will be used to construct a single date value. To create multiple date fields, run the tool multiple times.
The tool output includes a dataset with all fields from the input dataset in addition to a new date field. If you did not specify an output field name, the time field will be named TIMESTAMP by default. The output field type is date and contains the date and time information for each record.
When previewing date fields, the values will be shown in the time zone of your browser. When writing the values to a feature layer, they will be stored in UTC.
Limitations
The following are known limitations of the Create date time tool:
- The tool returns a single date field. To calculate multiple date fields, configure additional Create date time tools.
- The specified field and format pairs must calculate a complete date value, for example 12/23/2022 12:30:00. Date only values such as 12/23/2022 or time only values such as 12:30:00 are not supported for fields of type date.
- The format must exactly match the values in the specified field. For example, you cannot use a format of MM/dd/yyyy if the field contains a subset of those values, such as 12/30.
Licensing requirements
The following licensing and configurations are required:
- Creator or Professional user type
- Publisher, Facilitator, or Administrator role, or an equivalent custom role
To learn more about Data Pipelines requirements, see Requirements.