如果比当前时间Calendar.MONTH多或少,则无法比较

时间:2016-01-23 02:41:26

标签: android

我正在尝试检查日期以放置适当的分隔符,但问题是在比较Calendar.Months时,其他检查工作正常

if   (calendar.get(Calendar.DAY_OF_YEAR) > Calendar.getInstance().get(Calendar.DAY_OF_YEAR) && calendar.get(Calendar.YEAR) > Calendar.getInstance().get(Calendar.YEAR) ||
                        (calendar.get(Calendar.DAY_OF_YEAR) < Calendar.getInstance().get(Calendar.DAY_OF_YEAR) && calendar.get(Calendar.YEAR) > Calendar.getInstance().get(Calendar.YEAR)) ||
                        (calendar.get(Calendar.DAY_OF_YEAR) == Calendar.getInstance().get(Calendar.DAY_OF_YEAR) && calendar.get(Calendar.YEAR) > Calendar.getInstance().get(Calendar.YEAR))||
                        (calendar.get(Calendar.DAY_OF_YEAR) == Calendar.getInstance().get(Calendar.DAY_OF_YEAR) && calendar.get(Calendar.MONTH) > Calendar.getInstance().get(Calendar.MONTH)&&calendar.get(Calendar.YEAR) == Calendar.getInstance().get(Calendar.YEAR)))
                        {
                newTask.setDateStatus(ModelSeparator.TYPE_FUTURE);
                if (!adapter.containsSeparatorFuture) {
                    adapter.containsSeparatorFuture = true;
                    separator = new ModelSeparator(ModelSeparator.TYPE_FUTURE);
                    Toast.makeText(getActivity(),"Future",Toast.LENGTH_SHORT).show();
                }

0 个答案:

没有答案