Reads the number encoded in the b field of a EDIFACT or EANCOM DTM segment and returns it as an integer. The DTM format code a (data element 2379) specifies how the value b is interpreted.
Reads the number encoded in the b field of a EDIFACT or EANCOM DTM segment and returns it as an integer. The DTM format code a (data element 2379) specifies how the value b is interpreted.
Only certain format codes return a number. They can be divided into three groups:
801–814– Purely quantitative information, such as a number of days.107–110– The number of a day, week, or month within a year or month.6–9– A calendar date with an appended number. Only this number is returned; the date portion can be determined using the edifact/eancom DTM to timestamp parsing function.
The following rules apply to data processing:
The result is an integer. Leading zeros are ignored; a sign (
+or-) is allowed.The numeric part is not checked against a range of values.
Leading and trailing spaces in the format code
aare removed; the case sensitivity is ignored.The value
bis used without modification and must not contain any spaces.
Parameter
Parameter | Description |
|---|---|
| DTM format code (data element 2379), e.g., |
| The value from the DTM segment to be processed. |
| (optional) Part of a time period that is returned. |
| (optional) Error handling if
Default: |
| (optional) Forces an empty value. If |
Format codes
Format codes that represent a date, time, or time period without a numeric component (e.g., 102, 203, 718) are rejected. The edifact/eancom DTM to timestamp parsing function is intended for these format codes..
For the complete definition of all format codes, see the code list for UN/CEFACT data element 2379: UN/CEFACT UNCL 2379.
Examples
The parameters c, d, and e are empty unless otherwise specified.
Parameter a | Parameter b | Result |
|---|---|---|
6 | 2015022 (half the month) | 2 (second half of February 2015) |
6 | 2015023 (half the month) | 3, this section is not reviewed |
7 | 2024031 (week of the month) | 1 (first week of March 2024) |
8 | 202403021 (shift of the day) | 1 (shift 1 on 2 March 2024) |
9 | 2024030205 (time of day) | 5 (time period 05 on March 2, 2024) |
107 | 366 (day of the year) | 366 |
108 | 53 (week number in year) | 53 |
110 | 31 (day of the month) | 31 |
801 | 120215 (number of years) | 120215 |
801 | 007 (number of years) | 7 |
801 | -12 (number of years) | -12 |
804 | 30 (number of days) | 30 |
813 | 7 (day of the week, Monday = 1) | 7 |
Error handling
Parameter a | Parameter b | Parameter d | Parameter e | Result |
|---|---|---|---|---|
8 | 20240302 (shift of the day) | Terminated due to an error; the shift number is missing. | ||
102 | 20240301 | Processing aborted due to an error: unable to parse "20240301" with format code "102", because the code represents a date. | ||
102 | 20240301 | empty | Empty value (empty timestamp with the empty flag set). | |
801 | 12A (number of years) | Terminated with the error unable to parse "12A" with format code "801". | ||
801 | (empty) | Terminated with the error unable to parse with format code "801" (empty value). | ||
801 | 2147483648 (number of years) | Terminated due to an error; the value exceeds the integer range. | ||
801 | ABC (number of years) | now | Current date and time. | |
801 | true | An empty value, |