title: How to extract only year from created_at column
body: <p>Querying the database for the <code>created_at</code> value gives the following output:</p>
  
  <pre><code>&gt;&gt; kevin.created_at
  =&gt; Sun, 21 Aug 2016 07:46:26 UTC +00:00
  </code></pre>
  
  <p>How can I extract only the year from this information? <br>
  I tried to treat <code>kevin.created_at</code> as a string and see if I could get what I want with:</p>
  
  <pre><code>&gt;&gt; kevin.created_at.split[3].to_i
  </code></pre>
  
  <p>However I get this message:</p>
  
  <pre><code>NoMethodError: undefined method `split' for Sun, 21 Aug 2016 07:46:26 UTC +00:00:Time
  </code></pre>
  
  <p>Therefore I tried with:</p>
  
  <pre><code>&gt;&gt; kevin.created_at.to_a
  =&gt; [26, 46, 7, 21, 8, 2016, 0, 234, false, "UTC"]
  </code></pre>
  
  <p>So I may have a solution with:</p>
  
  <pre><code>&gt;&gt; kevin.created_at.to_a[5]
  =&gt; 2016
  </code></pre>
  
  <p>Is there any better or more elegant solution to query Postgresql for this information?</p>