title: How do I get a Date without time in Java?
body: <p>Continuing from Stack Overflow question <em><a href="https://stackoverflow.com/questions/2806360">Java program to get the current date without timestamp</a></em>:</p>
  
  <p>What is the most efficient way to get a Date object without the time? Is there any other way than these two?</p>
  
  <pre><code>// Method 1
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  Date dateWithoutTime = sdf.parse(sdf.format(new Date()));
  
  // Method 2
  Calendar cal = Calendar.getInstance();
  cal.set(Calendar.HOUR_OF_DAY, 0);
  cal.set(Calendar.MINUTE, 0);
  cal.set(Calendar.SECOND, 0);
  cal.set(Calendar.MILLISECOND, 0);
  dateWithoutTime = cal.getTime();
  </code></pre>
  
  <p><strong>Update</strong>:</p>
  
  <ol>
  <li><p>I knew about <a href="http://www.joda.org/joda-time/" rel="noreferrer">Joda-Time</a>; I am just trying to avoid additional library for such a simple (I think) task. But based on the answers so far Joda-Time seems extremely popular, so I might consider it.</p></li>
  <li><p>By <em>efficient</em>, I mean I want to avoid temporary object <code>String</code> creation as used by <code>method 1</code>, meanwhile <code>method 2</code> seems like a hack instead of a solution.</p></li>
  </ol>