如何从ParseObject获取特定数据

时间:2015-09-27 07:14:56

标签: java android android-studio parse-platform

我有班级名称(" RHospital") 我在列(" appointmentDate")中搜索日期列表,但我得到的是Full ParseObject,因为我写了查询方法ParseObject,但是我只想要日期(&#34) ; appointDate&#34) 那我该如何找回它呢?

我的问题是我不知道如何在Parse类中搜索特定数据列表 这是解析数据的屏幕截图 enter image description here

这是我的代码

Calendar cal = Calendar.getInstance();
        cal.set(2015, 8, 12, 0, 0, 0);
        Calendar sswal = Calendar.getInstance();
        sswal.set(2015, 8, 12, 23, 30, 0);
        Date dd = cal.getTime();
        Date mok =sswal.getTime();
        final ParseObject[] most = new ParseObject[15];
        Date moste[]=new Date[15];

  ParseQuery<ParseObject> query = ParseQuery.getQuery("RHospital");
    query.selectKeys(Arrays.asList("appointDate"));
    query.whereGreaterThanOrEqualTo("appointDate", dd);
    query.whereLessThanOrEqualTo("appointDate", mok);
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> list, com.parse.ParseException e) {
            if (list == null) {
                Log.d("score", "The getFirst request failed.");
            } else {
                mStatus = list;

               for (ParseObject Dated: list){
                    post =Dated.getParseObject("appointDate");
                    Log.d("appointDate", "retrieved a related date");
                }

            }
        }

    });

提前谢谢

1 个答案:

答案 0 :(得分:0)

使用它来获取日期:

Date post =Dated.getDate("appointDate");