title: What is the proper way to form Rails data before I store it in my Postgres interval data-type column?
body: <p>I’m using Rails 4.2.3 with a Postgres database.  In my database, I have a column “time_in_ms” of type, “interval”.  From my Rails form, I want to save my hours, minutes, and seconds drop downs into this single column, and then also displays the values accurately when they are pulled from the database.  What is the proper way to do this?  Right now, in my Rails model, I save milliseconds into my “time_in_ms” column.  So if this is the value</p>
  
  <pre><code>60000000
  </code></pre>
  
  <p>I see this in my Postgres database …</p>
  
  <pre><code>16666:40:00
  </code></pre>
  
  <p>Whatever that means.  Then when I try and display the values from the database, I get these errors:</p>
  
  <pre><code>undefined method `/' for "16666:40:00":String
  </code></pre>
  
  <p>complaining about this line …</p>
  
  <pre><code>&lt;td&gt;&lt;%= (my_object_time.time_in_ms/(1000*60*60))%24 %&gt;:&lt;%= ((my_object_time.time_in_ms/(1000*60))%60).to_s.rjust(2,'0') %&gt;:&lt;%= ((my_object_time.time_in_ms/1000)%60).to_s.rjust(2,'0') %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>How should I formulate my data before it is saved into Postgres and how should I then properly display it back?</p>