title: Difference between 2 DateTime in hours in Elixir
body: <p>My goal is to find a difference in hours between now and some provided date_time. I'm trying to do this this way:</p>
  
  <pre><code>pry(1)&gt; dt1
  #DateTime&lt;2017-10-24 05:12:46.000000Z&gt;
  
  pry(2)&gt; Ecto.DateTime.to_erl(dt1)
  ** (FunctionClauseError) no function clause matching in Ecto.DateTime.to_erl/1    
  
      The following arguments were given to Ecto.DateTime.to_erl/1:
  
          # 1
          #DateTime&lt;2017-10-24 05:12:46.000000Z&gt;
  
      Attempted function clauses (showing 1 out of 1):
  
          def to_erl(%Ecto.DateTime{year: year, month: month, day: day, hour: hour, min: min, sec: sec})
  
      (ecto) lib/ecto/date_time.ex:608: Ecto.DateTime.to_erl/1
      # ............
  </code></pre>
  
  <p>How to fix that? <strong>Or is there a better way to achieve my goal?</strong></p>
  
  <p><strong>Note</strong> that I don't use timex and won't use it, neither any third-party library. Only ones built-in in Elixir/Erlang/Phoenix.</p>