title: How to replace getDate() from the type Date which is deprecated?
body: <p>I have an existing program that I have to correct . It contains these lines :     </p>
  
  <pre><code>        Date startDate = new Date();
          int day = startDate.getDate() - 1;
  </code></pre>
  
  <p>but <strong>getDate()</strong> from the type <strong>Date</strong> is deprecated so i have to change it using <strong>Calender</strong>. I tried this :</p>
  
  <pre><code>Calendar startDate = Calendar.getInstance();
  startDate.add(Calendar.DATE, -1);
  int day= startDate.getTime();
  </code></pre>
  
  <p>but this results into following error :</p>
  
  <blockquote>
    <p>Type mismatch: cannot convert from Date to int</p>
  </blockquote>