Possible Duplicate:
converting timestamp to date in java
This is my database:
Date status
1343993311 Q
- 1343892452 C
- 1343892477 P
Here I have to check the query current date+status=Q information and get the count value.
This is my code:
public class TodayQ {
public int data(){
int count=0;
//count++;
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pro","root","");
PreparedStatement statement = con.prepareStatement("select * from orders where status='Q' AND date=CURDATE()");
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;
}
}
dis is my other class:
public class Demo {
public static void main(String[] args) throws ParseException{
TodayQ obj = new TodayQ();
System.out.println(obj.data());
}
}
Here I have to edit the date is (yyyy-mm-dd) format.Now I got the output.but I wish to use timestamp on my database.so how is converted timestamp to date in java.How is use that code in my code.please help me.How is to do????