title: Get current date in java
body: <p>How do I get current date details in java? I have developed a class:</p>
  
  <pre><code> public class RetailerWs {
  
   public String customerData(){
    String customerInfo = "";
    try{
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pro","root","");
     //Find customer information where the customer ID is maximum
     PreparedStatement statement =  con.prepareStatement("select * from orders where status='Q' AND date='2012-08-01'");
     ResultSet result = statement.executeQuery();
     int count=0;
      count++;
    // System.out.println(count);
     while(result.next()){
    System.out.println(count);
    }
        }
   catch(Exception exc){
   System.out.println(exc.getMessage());
    }
  
   return customerInfo;
   }
  </code></pre>
  
  <p>}</p>
  
  <p>This is another class.</p>
  
  <pre><code>  public class Demo {
    public static void main(String[] args){
      RetailerWs obj = new RetailerWs();
      System.out.println(obj.customerData());
    }
  
   }
  </code></pre>
  
  <p>if I run <code>demo</code>, it calls <code>RetailerWs</code> after that it displays the value of <code>count</code>. The problem is the currently I insert the date manually, i.e.</p>
  
  <pre><code>   PreparedStatement statement =  con.prepareStatement("select * from orders where status='Q' AND date='2012-08-01'");
  </code></pre>
  
  <p>But I want a query that fetches the current date. How can I create and call it? Please help me. </p>