title: Separate Date and Time objects
body: <p>I have a web-form where users can select a date from a calendar pop-up and a time from a dropdown. At the moment I am trying to store the date using a Date object. </p>
  
  <pre><code>@Required
  public Date date;
  </code></pre>
  
  <p>And the output of this object is something like: </p>
  
  <blockquote>
    <p>January 1, 1970, 00:00:00 GMT</p>
  </blockquote>
  
  <p>What I would really like to do is separate this and store the date in a format like <em>27/02/2013</em> and have the time as a separate object in 24 hour format e.g. <em>23:45</em>. I am unsure how to do this with java.</p>
  
  <p>Resolved using SimpleDateFormat:</p>
  
  <pre><code>//also the import
  import java.text.*;
  
  @Required
  public SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yy");
  public String date = simpleDateFormat.format(new Date());
  
  @Required
  public SimpleDateFormat simpleTimeFormat = new SimpleDateFormat("hh:mm");
  public String time = simpleTimeFormat.format(new Date());
  </code></pre>