title: Rails : Given that my database is in UTC, and my Time.zone US Eastern, how do I save a time in US Pacific?
body: <p>(I'm using Rails 3.2.3 on Ruby MRI 1.9.2)</p>
  
  <p>Everything is stored centrally in UTC. This is good. Each User has a 'timezone' property. My ApplicationController has a before filter to adjust Time.zone to the User's stored timezone. This is also good.</p>
  
  <p>Given the above, if my User completes a datetime select with a time, that time is expected to be in Time.zone and Rails will automatically adjust and save this as UTC. This too, is good.</p>
  
  <p>Now: I wish to enable my Users to fill out a time <strong>in another time zone</strong> and then have it stored as UTC. However, Rails is expecting the completed date time select to have been filled out in the (previously set by ApplicationController) Time.zone. Therefore Rails adjusts to UTC <strong>incorrectly</strong>.</p>
  
  <p><strong>How do I achieve my goal of saving a time that has been input as being in a third time zone?</strong></p>
  
  <p>Illustration:</p>
  
  <p>My usage scenario is a User in Florida adjusting a date for a Document belonging to a Hotel on the West Coast. They are looking to enter a time for the West Coast.</p>
  
  <p>I'm using jQuery to style text boxes with a styled picker, so I have a method to output a string to the text box:</p>
  
  <pre><code>&lt;%= f.text_field(:created_at, :value =&gt; adjusted_to_hotel_time(@document.created_at), :class =&gt; 'text datetime_picker') %&gt;
  
  def adjusted_to_hotel_time(time)
    time.in_time_zone(@current_hotel.timezone).to_s(:admin_jquery) # formatted for the jQuery datetime_picker text fields.
  end
  </code></pre>
  
  <p>This is working perfectly, but Rails adjusts to UTC incorrectly when the @document is saved. I don't know what I don't know - how can I 'tag' the data entered in that field as being in @current_hotel.timezone, so that Rails will offset to UTC correctly when it saves the parent object?</p>