I have a String s date in following format 05-10-2020
I want to convert this String to Date in following format dd-MM-yyyy
so I can use it in below query for my Sqlite db
SimpleDateFormat simpledateformat = new SimpleDateFormat("dd-MM-yyyy");
String s = app.getDate(); // returns "05-10-2020"
Date date = simpledateformat.parse(s);
String selectQuery = "SELECT * FROM User Where Date !=" + date;
But date is returns date in follwoing format Mon Oct 05 00:00:00 GMT+03:00 2020
simpledateformat.format(s);, just a thoughtSimpleDateFormatand friends. See if you either can use desugaring or add ThreeTenABP to your Android project, in order to use java.time, the modern Java date and time API. It is so much nicer to work with.