0

我正在为我的移动后端使用 App42。我需要将日期字段放在我正在保存的 JSON 中,并进一步对其进行查询以进行日期搜索。我无法在文档中找到它。谁能让我知道执行此操作所需的日期格式是什么?

4

1 回答 1

0

您没有提到您使用的是哪个 SDK。我在 App42 json 存储中发布了用于日期搜索的 Android 示例代码。

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);
于 2013-12-04T08:02:15.020 回答