I am using App42 for my mobile backend. I need to put date field in my JSON that I am saving and further do a query on it for date search. I am not able to find it in document. Can anybody please let me know what is the required date format to do this?
Asked
Active
Viewed 204 times
0
-
unfortunately cant add the tag for app42. – Puneet Jain Dec 03 '13 at 07:34
1 Answers
0
You are not mentioned that which SDK you are using. I am posting an Android sample code for date search in App42 json storage.
String yourDate = Util.getUTCFormattedTimestamp();
JSONObject jsonData = new JSONObject();
jsonData.put("name", "sachin");
jsonData.put("DOB", yourDate);
// Inserting json document.
Storage storageObj = storage.insertJSONDocument("dbName", "collectionName", jsonData);
System.out.println(storageObj);
// building query.
Query query = QueryBuilder.build("DOB", yourDate, Operator.EQUALS);
// find documents by query.
Storage result = storage.findDocumentsByQuery("dbName", "collectionName", query);
System.out.println(result);

Akshay
- 187
- 1
- 3
- 13