Compare Dates Stored as String using Datetime

主宰稳场 提交于 2019-12-20 02:29:23

问题


I have stored dates' date as String in my database in the following format :

 dateFormater = new SimpleDateFormat("dd MMM yyyy");

Now i need to access data between the two dates startWeekDate and endWeekDate both formatted as above. Currently , the where clause of my query is :

at_date BETWEEN Datetime( '"+startWeekDate+"') AND Datetime( '"+endWeekDate+"')

Where startWeekDate is '10 Aug 2014' and endWeekDate is '16 Aug 2014'. But I am getting the null result on my TextView. Can any one guide me how can i do this.


回答1:


This is not one of the supported date formats.

Just use yyyy-MM-dd.



来源:https://stackoverflow.com/questions/25248848/compare-dates-stored-as-string-using-datetime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!