我正在使用App42作为我的移动后端。我需要将日期字段放在我保存的JSON中,并进一步对其进行查询以进行日期搜索。我在文档中找不到它。谁能告诉我做这件事所需的日期格式是什么?
发布于 2013-12-04 16:02:15
没有提到您使用的是哪个SDK。我在App42 json存储中发布了一个用于日期搜索的安卓示例代码。
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);https://stackoverflow.com/questions/20345363
复制相似问题