# LGF_StringToDTL_ISO (FC / 3.1.0)

Overview

Author: Siemens Digital Industry

## Short description

This function converts a character string in international format (ISO 8601) with date and time components into the data type DTL.

### Block Interface

| LGF_StringToDTL_ISO (FC) |
--- | --- | ---
String |  |  | date |  | Ret_Val |  |  | DTL
|  |  |  |  | error |  |  | Bool
|  |  |  |  | status |  |  | Word

### Input parameter

Identifier | Data type | Description
--- | --- | ---
date | String | Date as a character string according to the format. Example: `2019-01-22 14:07:57.696417000`.

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | DTL | The converted date and time in the format DTL
error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table)

### Status & Error codes

Code / Value | Identifier / Description
--- | ---
16#0000 | STATUS_FINISHED_NO_ERROR Status: Execution finished without errors
16#7000 | STATUS_NO_JOB Status: No current job processed
16#8201 | ERR_FORMAT_YEAR Error: YEAR out of range of DTL - YEAR value does not correspond to the format or specification (outside the value range of DTL)
16#8202 | ERR_FORMAT_MONTH Error: MONTH out of range of DTL - MONTH value does not correspond to the format or specification (outside the value range of DTL)
16#8203 | ERR_FORMAT_DAY Error: DAY out of range of DTL - DAY value does not correspond to the format or specification (outside the value range of DTL)
16#8204 | ERR_FORMAT_HOUR Error: HOUR out of range of DTL - HOUR value does not correspond to the format or specification (outside the value range of DTL)
16#8205 | ERR_FORMAT_MINUTE Error: MINUTE out of range of DTL - MINUTE value does not correspond to the format or specification (outside the value range of DTL)
16#8206 | ERR_FORMAT_SECOND Error: SECOND out of range of DTL - SECOND value does not correspond to the format or specification (outside the value range of DTL)
16#8207 | ERR_FORMAT_NANOSECOND Error: NANOSECOND out of range of DTL - NANOSECOND value does not correspond to the format or specification (outside the value range of DTL)
16#8400 | ERR_DATE_STRING_EMPTY Error: Input String `date` is empty
16#8401 | ERR_DATE_STRING_TO_SHORT Error: Input String `date` is too short - minimum is 'YYYY-MM-DD HH:MM:SS'

## Functional description

The block reads a date as a character string and converts it to the data type DTL. The individual date components in the character string are separated according to the international format (ISO 8601). The separator between the components in the character string is irrelevant.

### International format (ISO 8601):

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | Siemens Industry Online Support
| 15.06.2016 | First released version
| 1.0.1 | Siemens Industry Online Support
| 02.01.2017 | Upgrade: TIA Portal V14 Update 1
| 1.0.2 | Siemens Industry Online Support
| 17.08.2018 | Upgrade: TIA V15 Update 2
| 1.0.3 | Siemens Industry Online Support
| 23.11.2018 | Upgrade: TIA V15.1
| 1.0.4 | Simatic Systems Support
| 17.07.2019 | Reworked from "LGF_StringToDTL" to "LGF_StringToDTL_ISO" Removed format and split into two blocks Bugfix - set weekday correctly Correction of the weekday of DTL, comments added Add ENO handling, adjust comments in interface
| 3.0.0 | Simatic Systems Support
| 23.04.2020 | Set version to V3.0.0 Harmonize the version of the whole library
| 3.0.1 | Simatic Systems Support
| 23.02.2021 | Insert documentation
| 3.1.0 | Simatic Systems Support
| 31.07.2025 | Fix bug - missing error code in case of wrong date string