需要将 Date 放入 Parse.com without Time 而相反的方法

need the way to put Date in Parse.com without Time and the opposite

不知道如何将日期或时间放入 Parse.com。 即使在 SimpleDateFormat 之后,Date 对象也会使用完整的默认缺失数据进行传输。

代码示例:

DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
DateFormat timeFormat = new SimpleDateFormat("HH:mm");
try {
    date = dateFormat.parse(mDate.getText().toString());
    time = timeFormat.parse(mTime.getText().toString());
} catch (java.text.ParseException e) {

...

meeting.put(ParseConstants.KEY_DATE, date);
meeting.put(ParseConstants.KEY_TIME, time);

但是在 Parse.com 我收到了 2 个具有完整日期参数的 DATE 对象:它们都有日期和时间。

知道我需要做什么吗?

非常感谢。

我终于做到了。

我使用日历 class 并在使用日期和时间选择器时填写每个项目(年、月、日、小时、分钟)。并使用 Calendar.getTime 方法将其转换为 Parse.com 理解的日期 class。

Calendar mDateTime = Calendar.getInstance();
...
mDateTime.set(Calendar.YEAR, selectedYear);
mDateTime.set(Calendar.MONTH, selectedMonth);
mDateTime.set(Calendar.DAY_OF_MONTH, selectedDay);
...
meeting.put(ParseConstants.KEY_DATETIME, mDateTime.getTime());

所以我仍然需要输入日期和时间以及工作解析日期 class。