Time (TM) -- HL7v2 primitive data type.
Format: HH[MM[SS[.S[S[S[S]]]]]][+/-ZZZZ]
Parses to a %TM{} struct preserving all fields for lossless round-trip
encoding. Similar to DTM but without the date portion.
Summary
Types
@type t() :: %HL7v2.Type.TM{ fraction: binary() | nil, hour: non_neg_integer(), minute: non_neg_integer() | nil, offset: binary() | nil, original: term(), second: non_neg_integer() | nil }
Functions
Encodes a TM value back to HL7v2 format.
Examples
iex> HL7v2.Type.TM.encode(%HL7v2.Type.TM{hour: 14, minute: 30})
"1430"
iex> HL7v2.Type.TM.encode(%HL7v2.Type.TM{hour: 14, minute: 30, second: 22, fraction: "1234", offset: "+0100"})
"143022.1234+0100"
iex> HL7v2.Type.TM.encode(nil)
""
Parses a TM string into a %TM{} struct.
Examples
iex> HL7v2.Type.TM.parse("143022.1234+0100")
%HL7v2.Type.TM{hour: 14, minute: 30, second: 22, fraction: "1234", offset: "+0100"}
iex> HL7v2.Type.TM.parse("1430")
%HL7v2.Type.TM{hour: 14, minute: 30}
iex> HL7v2.Type.TM.parse("14")
%HL7v2.Type.TM{hour: 14}
iex> HL7v2.Type.TM.parse("")
nil
iex> HL7v2.Type.TM.parse(nil)
nil