     case Integer.parse valstr do
       {value, ""} -> value
       _ -> {:error, "invalid integer"}
+    end
+  end
+
+  defp transform_value(valstr, :datetime) do
+    case Timex.parse(valstr, @date_format) do
+      {:ok, dt} ->
+        dt |> Timex.to_erl |> Timex.to_datetime(:local)
+      {:error, _} = error -> error
     end
   end
 

defmodule Serum.HeaderParser do
  alias Serum.Error

  @type options :: [{atom, value_type}]
  @type value_type :: :string | :integer | {:list, value_type}
  @type value :: binary | integer | [binary] | [integer]

  @spec parse_header(IO.device, binary, options, [atom]) :: Error.result(map)

         {"header parse error: #{error}", fname, 0}}
    end
  end

  @spec handle_error(term, binary) :: Error.result

  defp handle_error([missing], fname) do
    {:error, :invalid_header,
