Java Calendar Time isEquals(Calendar startTime, Calendar timeCurrent, int type)

Here you can find the source of isEquals(Calendar startTime, Calendar timeCurrent, int type)

Description

is Equals

License

LGPL

Declaration

public static boolean isEquals(Calendar startTime, Calendar timeCurrent, int type) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.Calendar;

public class Main {
    public static boolean isEquals(Calendar startTime, Calendar timeCurrent, int type) {
        if (startTime == null || timeCurrent == null) {
            return false;
        }/*from   w w  w.j a  v  a  2 s. co  m*/
        if (startTime.get(Calendar.YEAR) == timeCurrent.get(Calendar.YEAR)) {
            if (type == Calendar.YEAR) {
                return true;
            }

            if (startTime.get(Calendar.WEEK_OF_YEAR) == timeCurrent.get(Calendar.WEEK_OF_YEAR)) {
                if (type == Calendar.WEEK_OF_YEAR) {
                    return true;
                }

            }

            if (startTime.get(Calendar.MONTH) == timeCurrent.get(Calendar.MONTH)) {
                if (type == Calendar.MONTH) {
                    return true;
                }

                if (startTime.get(Calendar.DAY_OF_MONTH) == timeCurrent.get(Calendar.DAY_OF_MONTH)) {
                    if (type == Calendar.DAY_OF_MONTH) {
                        return true;
                    }

                    if (startTime.get(Calendar.HOUR_OF_DAY) == timeCurrent.get(Calendar.HOUR_OF_DAY)) {
                        if (type == Calendar.HOUR_OF_DAY) {
                            return true;
                        }

                    }
                }
            }

        }

        return false;

    }
}

Related

  1. getTimeZone(Calendar cal)
  2. getTimeZoneCalendar(final TimeZone timeZone)
  3. getTimezoneString(Calendar cal)
  4. hasTime(Calendar cal)
  5. hasTimePart(Calendar calendar)
  6. isFirstMorning(Calendar time, Calendar previous)
  7. isFuture(Calendar time)
  8. isMorning(Calendar time)
  9. isOverTime(Calendar lastTime, Calendar currentTime, Calendar begTime, Calendar endTime)