title: Date compares in Rails SQL
body: <p>I have this query in Rails (mysql database).</p>
  
  <pre><code>planSubscriptions = PlanSubscription.find_by_sql(["SELECT ps.*
       FROM plan_subscriptions ps, plans p, states s
       WHERE p.name = 'Unlimitted'
       AND s.name = 'Confirmed' 
       AND p.id = ps.plan_id 
       AND s.id = ps.state_id
       AND date_format(ps.updated_at + INTERVAL 1 MONTH,'%Y-%m-%d') &lt;= date_format(NOW(),'%Y-%m-%d')"])
  </code></pre>
  
  <p>It´s not working because malformed format string - %Y</p>
  
  <p>I need to compare only the date (not the times). What is the right syntax?</p>