# DTM Decoder

Industry: Intermodal

**Key point — UN/EDIFACT DTM dates and times**

A `DTM` value means nothing without its format code, and most codes carry no offset. A value with no offset is a local time at a place the value does not name. It is not UTC.

Paste a UN/EDIFACT `DTM` segment, or type a value and its format code (data element 2379). The tool takes the value apart field by field, says what it states, and reads an offsetless value in the zones you choose. A value means nothing without its code, and most codes carry no offset. The tool calls [`classifyEdifactDtmFormat`](/gmt/reference/intermodal/parse/classifyEdifactDtmFormat/) on the code, then the parser of the kind that came back, and everything on the page is what those calls returned.

**How a segment is split.** The tool splits a segment with the UN/EDIFACT default service characters and reads the three components of the `DTM` composite. The function qualifier is shown as sent and never interpreted. A custom `UNA` service string is not read. Only a segment is un-released: a bare value reaches the library as typed, so a `?` left in it is refused, and the reason says so.

**The two verdicts.** The offset is stated, as with `205`, `208` or a `303` value ending in `+02`, `UTC` or `GMT`: the tool shows the instant. Or the offset is not stated, as with `203`, a date, a time or a period: the tool shows where the value lands in the zones you pick. A value or a code the library does not read shows `NO SIGNAL` with one sentence saying why. A `CET` under `303` is that, because the field holds a signed hour, `UTC` or `GMT`. A two-digit-year code is that too, and the sentence points at the pattern parsers with a `yearWindow`.

**Why the zones are yours.** The library maps no place to a zone, so the four zones are your picks. The `203` and `CET` presets open with four example zones, and the value does not say any of them. Each row calls `resolveLocal` with `disambiguation: "reject"`: a time the clock shows twice, or never, is not resolved, and the row says why.

**The functions.** There is one parser, one formatter and one validator for each kind of value: [`parseEdifactDateTime`](/gmt/reference/intermodal/parse/parseEdifactDateTime/) and [`parseEdifactOffsetDateTime`](/gmt/reference/intermodal/parse/parseEdifactOffsetDateTime/) are two of the six. The matching formatter writes the value back, [`isValidEdifactDtmFormat`](/gmt/reference/intermodal/validate/isValidEdifactDtmFormat/) tells an unknown code from a bad value, and [`resolveLocal`](/gmt/reference/instant/convert/resolveLocal/) turns a local time into an instant in a zone you name. The rules are in [Intermodal: EDI Timestamps](/gmt/guides/industries/intermodal-edi-timestamps/).

**Worth trying:** [a `CET` value](/gmt/tools/dtm-decoder/?w=dtm&wa=%7B%22input%22%3A%22DTM%2B137%3A202406151430CET%3A303%27%22%7D) —
the result is `NO SIGNAL`, and the sentence says the `303` field holds a signed hour, `UTC` or `GMT`. Replace `CET` with `UTC` and the value states its offset. Then [a two-digit year](/gmt/tools/dtm-decoder/?w=dtm&wa=%7B%22input%22%3A%22240615%22%2C%22format%22%3A%22101%22%7D) —
the result is `NO SIGNAL`: no EDI function reads a two-digit year, and the sentence names the pattern parser and the `yearWindow` that read it. For a value that returns a result, try [a period of local date-times](/gmt/tools/dtm-decoder/?w=dtm&wa=%7B%22input%22%3A%22202406151430202406201600%22%2C%22format%22%3A%22719%22%2C%22zone1%22%3A%22Asia%2FKolkata%22%2C%22zone2%22%3A%22Europe%2FBerlin%22%7D): each end lands in the zones you chose.
