android
OrmLite where clause and SQL between with java.util.date
I try to create a query with a where clause which filters between dates. My query looks something like java.util.Date date1 = ... java.util.Date date2 = ... where().between("datefield", date1, date2) But it doesn't work. I am building my query with the QueryBuilder and I use selectRaw(...) and queryRaw(...). Can anyone help?
Yeah, this isn't going to work because under Android, Date fields are being persisted as strings which don't compare right when using SQL between. One way to fix this would be to store your Date fields as longs instead: #DatabaseField(dataType = DataType.DATE_LONG) private Date dateField; This will store the Date as the epoch milliseconds long number which is comparable and which will work with between.
Related Links
BroadcastReceiver keep getting data when unregisterd
Contact Android App via USB
Save image from ImageView to device gallery
Dynamically Created Radio Button or CheckBox does not use Color Accent
Debug instrumentation test
How to Implement Swipe In Android Game Without View
android-display multiple images and to next line if no enough room
How to draw a rect in the middle of screen-Android development
Native Android app crashes with SIGILL on x86
Switching to Landscape is not switching to correct XML
Lowest OpenGL ES version to use Vertex Buffer Objects
onSensorChanged() not calling for Gyroscope Sensor
Phonegap run android gives error
GCM is not working on Android Virtual Device: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
how do i create the database in my android app?
EditText with “text” inputType not hiding error popup when text is changed