title: calculate between two dates in postgresql
body: <p>I want to calculate between two dates.</p>
  
  <pre><code>create table greatestdate(name varchar(20),city varchar(20),current_dates varchar(12),previous_date varchar(12));// create table
  
  
  
  insert into greatestdate values('samuel','newyork','02-04-2013','01-01-2013'); //insert values
  
  select * from greatestdate where (current_dates -previous_date)&gt; 2 months as result;
  </code></pre>
  
  <p>however iam getting syntax error. kindly please any one suggest me.</p>
  
  <p>i tried this code,</p>
  
  <pre><code>select * from greatestdates where (now() -  previous_date) &lt; interval '2 month';
  </code></pre>
  
  <p>getting error message as,</p>
  
  <p>ERROR:  operator does not exist: integer &lt; interval
  LINE 1: ...atestdates where (current_dates -  previous_date) &lt; interval...
                                                               ^
  HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.</p>
  
  <p>i am using postgresql 9.2 version,</p>