亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

比較時間戳時的 Firestore 查詢問題

比較時間戳時的 Firestore 查詢問題

慕村9548890 2021-10-20 11:25:21
我在 Firestore 中有數據,我正在比較其中的時間對象。當我使用查詢等其他對象進行"ref" and "title"查詢時,成功返回了一些數據,但隨著時間的推移,它不返回任何內容。String dateString = "9-26-2018";我將此日期轉換為timestamp并傳入查詢:Timestamp timestamp = new Timestamp(dateString);DateFormat df = DateFormat.getDateTimeInstance();df.setTimeZone(TimeZone.getTimeZone("UTC"));Date utcTime = new Date(df.format(date));System.out.println("MyDates >>" +utcTime + " >> "+ timestamp.toDate());CollectionReference ref = db.collection("news");Query newsQuery = ref.whereEqualTo("time", utcTime );mNewsList.clear();newsQuery.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {                @Override                public void onComplete(@NonNull Task<QuerySnapshot> task) {                    if (task.isSuccessful()) {                        System.out.println("DocumentData >> " + task.getResult().size());                        for (QueryDocumentSnapshot document : task.getResult()) {                            News news = document.toObject(News.class);                            mNewsList.add(news);                        }                        // refreshing recycler view                        mAdapter.notifyDataSetChanged();                        // stop animating Shimmer and hide the layout                        mShimmerViewContainer.stopShimmerAnimation();                        mShimmerViewContainer.setVisibility(View.GONE);                    } else {                        System.out.println("Error getting documents."+ task.getException());                    }                }            });我得到的是 task.getResult().size() = 0所以我的問題是如何比較 Firestore 中的時間戳?更新 >> 日期輸出 >>MyDates >>Tue Sep 25 18:30:00 GMT+05:30 2018 >> Wed Sep 26 00:00:00 GMT+05:30 2018
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 165 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號