I would go with the direct struct update.
with {:ok, dt, 0} <- DateTime.from_iso8601("2019-11-10 13:27:00.0Z"),
{:ok, t} <- Time.from_iso8601("11:50:07.00+02:30"),
do: %DateTime{dt | hour: t.hour, minute: t.minute,
second: t.second, microsecond: t.microsecond}
#⇒ ~U[2019-11-10 11:50:07.00Z]
The above would discard the offset, though, and there is no clean way to get the offset in the Time struct because generally speaking the offset [arguably] has a meaning for the dates only. The below would be probable better:
date =
DateTime.from_iso8601("2019-11-10 13:27:00.0Z")
|> elem(1)
|> DateTime.to_date()
|> Date.to_iso8601()
DateTime.from_iso8601(date <> " 11:50:07.00+02:30")
#⇒ {:ok, ~U[2019-11-10 09:20:07.00Z], 9000}






















