Search code examples
javajdbcms-access-2007

MS Access retrieve data between two dates using JDBC


I want to retrieve data between two dates from MS Access using JDBC.

I have tried

String query= "SELECT lastlogin FROM loginHistory " +
            "WHERE lastlogin BETWEEN #01/07/2013# AND #03/07/2013#"+
            "ORDER BY lastLogin DESC";

I am not getting the desired results. Whats the problem. please help me out !

Thank You.


Solution

  • got the solution by transforming the date format from 01/07/2013 to 2013/07/01

    String query= "SELECT lastlogin FROM loginHistory " +
                "WHERE lastlogin BETWEEN #2013/07/01# AND #2013/07/03#"+
                "ORDER BY lastLogin DESC";
    

    Thank You all for supporting me..