title: Equivalent of strftime in Postgres
body: <p>After migrating my SQLite database to Postgres on the development server, I get the </p>
  
  <pre><code>PG::UndefinedFunction: ERROR:  function strftime(unknown, date) does not exist
  </code></pre>
  
  <p>Is there a function I could use to keep the functionality across my app? </p>
  
  <p>Edit: tried using to_char but failed miserably. In particular, I do not understand how to implement it in a construction such as</p>
  
  <pre><code>def self.query_by_year_month(y, m)
    where("strftime('%Y', date) = ? and strftime('%m', date) = ?", y, m)
  end
  </code></pre>
  
  <p>Thank you!</p>