title: extract day from Date
body: <p>I receive a timestamp from a <a href="https://en.wikipedia.org/wiki/SOAP" rel="nofollow noreferrer">SOAP</a> service in milliseconds. So I do this:</p>
  
  <pre><code>Date date = new Date( mar.getEventDate() );
  </code></pre>
  
  <p>How can I extract the day of the month from date, since methods such as <a href="https://docs.oracle.com/javase/10/docs/api/java/util/Date.html#getDay()" rel="nofollow noreferrer"><code>Date::getDay()</code></a> are deprecated?</p>
  
  <p>I am using a small hack, but I do not think this is the proper way to obtain day-of-month. </p>
  
  <pre><code>SimpleDateFormat sdf = new SimpleDateFormat( "dd" );
  int day = Integer.parseInt( sdf.format( date ) );
  </code></pre>