title: Return the count value in java
body: <p>Hi i have develop on example.
  This is my code:</p>
  
  <pre><code>public class GetMonthFromDate {
    public int data() {
      int count=0;
      java.sql.Timestamp timeStamp = new Timestamp(System.currentTimeMillis());
      java.sql.Date date = new java.sql.Date(timeStamp.getTime()); 
  
      //count++;
  
      try {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con =
          DriverManager.getConnection("jdbc:mysql://localhost:3306/xcart-432pro",
                                      "root", "");
  
        PreparedStatement statement =
          con.prepareStatement("select * from xcart_order_status_history where date_time='date'");
        ResultSet result = statement.executeQuery();
        while (result.next()) {
          // Do something with the row returned.
          count++; //if the first col is a count.
        }
      } catch(Exception exc) {
        System.out.println(exc.getMessage());
      }
  
      return count;
    }
  }
  </code></pre>
  
  <p>in above code is not worked for me.</p>
  
  <p>Here i have use this code </p>
  
  <pre><code>java.sql.Timestamp timeStamp = new Timestamp(System.currentTimeMillis());
  java.sql.Date date = new java.sql.Date(timeStamp.getTime()); 
  </code></pre>
  
  <p>means give the output is <code>2012-08-08</code> only. So only i have to call date in my code. but it is not work for me.displayed returns the count value is <code>0</code>. o is wrong. <code>2</code> only correct. because matched query have 2 values in my database.</p>
  
  <pre><code>select * from xcart_order_status_history where date_time='date'
  </code></pre>