Value Is Not a Valid HL7v2 Datetime (DTM)
A field typed as DTM or TS must follow the HL7v2 datetime pattern: YYYY[MM[DD[HH[MM[SS[.S[S[S[S]]]]]]]]] with an optional +/-ZZZZ timezone offset. The supplied value does not match.
HL7v2 · Error
The error
is not a valid HL7v2 datetime (DTM)Why it happens
Using an ISO-8601 string with dashes and a T separator (2024-01-15T13:55:00), inserting slashes or spaces, or carrying over a FHIR-style timestamp into an HL7v2 field.
How to fix it
Format the value as contiguous digits with no separators. 2024-01-15 1:55 PM becomes 20240115135500. Append a timezone like +1000 if needed. Do not use dashes, colons, or the letter T.
Example
The snippet below triggers the error:
PID|1||12345^^^H^MR||DOE^JOHN||1980-01-01|MThe corrected version:
PID|1||12345^^^H^MR||DOE^JOHN||19800101|MFrequently asked questions
Can I send just a year or year-month?
Yes. DTM is variable precision. 1980, 198001, and 19800101 are all valid. You add time components only as far as you know them. The separators-free digit format is what matters.
How do I include a timezone?
Append +ZZZZ or -ZZZZ after the time, for example 20240115135500+1000. The offset is four digits (hours and minutes) with a leading sign.
Related
- Open the HL7v2 Validator
- All validation errors
- Message Does Not Begin With an MSH Segment
- MSH-1 Field Separator Must Be Exactly One Character
- MSH-2 Encoding Characters Must Be Exactly 4 Characters
- Delimiter Characters Are Not Unique
- Required Segment Is Missing
- Required Field Is Missing or Empty
- Segment Appears More Times Than Allowed
- Segment Is Not Defined in This HL7v2 Version