Client SDK Android
Application ID 0557210D-0CD5-4724-FFDB-DB6B680CA200
Expected Behavior
Deleting objects from user table using where clause with dates, specifically lastLogin works.
String whereClause = "lastLogin before '" + sdf.format(calendarRef.getTime()) + "'";
int result = Backendless.Data.of("Users").remove(whereClause);
Actual Behavior
Running code pasted below gives exception. I don’t understand what am I doing wrong? Provided data format is supported.
BackendlessException{ code: ‘3027’, message: ‘Unknown error: Data truncation: Incorrect datetime value: ‘12/27/2020’ for column ‘lastLogin’ at row 1’, extendedData: ‘{}’, detail: ‘Unknown error: Data truncation: Incorrect datetime value: ‘12/27/2020’ for column ‘lastLogin’ at row 1’ }
Reproducible Test Case
final int maxNumOfMonths = 6;
final SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.getDefault());
Calendar calendarRef = Calendar.getInstance();
calendarRef.add(Calendar.MONTH, -maxNumOfMonths);
String whereClause = "lastLogin before '" + sdf.format(calendarRef.getTime()) + "'";
int result = Backendless.Data.of("Users").remove(whereClause);