title: How to preserve timezone when using Time.to_s(:db)?
body: <p>I'm trying to convert Time object with PST timezone.</p>
  
  <pre><code>zone = ActiveSupport::TimeZone.new("Pacific Time (US &amp; Canada)")
  now = Time.now.in_time_zone(zone)
  </code></pre>
  
  <p>when I output <strong>now</strong>, it's correct. when I do <strong>Time.now.in_time_zone(zone).to_s(:db)</strong>, it outputs GMT (original date).</p>
  
  <p>How do I fix it?</p>
  
  <p>Update: Looks like..the following code works</p>
  
  <pre><code>zone = ActiveSupport::TimeZone.new("Pacific Time (US &amp; Canada)")
  now = Time.now.in_time_zone(zone).strftime("%Y-%m-%d %H:%M:%S")
  </code></pre>