How to convert date to mysql date format

Table1

id         int        pk
searchdate datetime
amount     float

Data for Table1

id   searchdate   amount
1    2014-02-05    100
2    2014-02-02    245
3    2014-02-11    344

here i want data between 2014-02-01 to 2014-02-10, but what i want from datetime picker is "01-02-2014" (dd-mm-yyyy format). please help me to create MySQL between query.

Jon Skeet
people
quotationmark

Don't use string conversions at all. Use a PreparedStatement, and the setTimestamp method.

// TODO: Cleanup etc
PreparedStatement st = conn.prepareStatement(
    "select * from table1 where searchdate >= ? and searchdate < ?");
st.setTimestamp(1, startDateTimeInclusive); // java.sql.Timestamp values
st.setTimestamp(2, endDateTimeExclusive);

Unless your ultimate intention is a string, you should avoid string conversions.

people

See more on this question at Stackoverflow