title: How to find days between two date using jdo
body: <p><strong>What I have to do</strong></p>
  
  <p>I have to find those records whose duration is more than 72 days and don't have to use raw SQL query.</p>
  
  <p><strong>Basic Structure</strong></p>
  
  <pre><code>public class Subscription {
      String status;
      Date startDate;
      Date endDate;
  }
  </code></pre>
  
  <p><strong>Changed Structure</strong> (because of JDO limitation or my less knowledge of JDO).</p>
  
  <pre><code>public class Subscription {
      String status;
      Long startDate; /* Date in epoch format */
      Long endDate; /* Date in epoch format */
      /* There are some other fields which are not needed for this question*/
  }
  
  
  public class PerformOperation {
      public static void main() {
          long day = 1000*60*60*24;
          Query query = pm.newQuery(Subscription.class); /*where pm is PersistentManager*/
          query.setFilter("(endDate - startDate)/day &gt;72");
          query.declareParameter("double day");
          List&lt;Subscription&gt; subs = query.execute(day);
      }
  }
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>I don't want to change basic structure of domain class. Is there any better way to find days between two dates using jdo. </p>