toDuration()

This function is deprecated.

Returns the date created from an EDIFACT DTM segment using the format code a and the encoded date value b.

If a format code is used that is not allowed or a coded date value that does not match the format code, the function terminates with an error (see examples).

Parameters


Parameter

Description

a

Encoded date value.

b

Format code . Allowed codes: 305, 306, 406, 501, 502, 503, 701 - 711 , 713 , 715 - 720 , 801 - 812 . Note: For the codes, see page https://www.edifactory.de/edifact/directory/D96A/data-element/2379 or similar pages.

c

(optional) 1 if the 'from' part of a duration should be used, 2 if the 'until' part of a duration should be used. Default: 2. Note: 1 second is always automatically added to the 'until' part.

d

Time zone.

Examples


Parameter a

Parameter b

Parameter c

Parameter d

Result

2009111200-2009131115

713

1

2020-09-11 12:00:00.0

2009111200-2009131115

713



2020-09-13 11:15:01.0

2009111200-2009131115

713

2

2020-09-13 11:15:01.0

1111

401



Termination with an error (invalid code).