Java Calendar Day isAllDayEvent(Calendar dtStart, Calendar dtEnd)

Here you can find the source of isAllDayEvent(Calendar dtStart, Calendar dtEnd)

Description

is All Day Event

License

Mozilla Public License

Declaration

public static boolean isAllDayEvent(Calendar dtStart, Calendar dtEnd) 

Method Source Code


//package com.java2s;
//License from project: Mozilla Public License 

import java.util.Calendar;

public class Main {
    public static boolean isAllDayEvent(Calendar dtStart, Calendar dtEnd) {
        boolean startAtNullOClock = false;
        boolean endAtNullOClock = false;
        boolean allDayEvent = false;

        startAtNullOClock = ((dtStart.get(java.util.Calendar.MILLISECOND) == 0)
                && (dtStart.get(java.util.Calendar.SECOND) == 0) && (dtStart.get(java.util.Calendar.MINUTE) == 0)
                && (dtStart.get(java.util.Calendar.HOUR_OF_DAY) == 0));

        endAtNullOClock = ((dtEnd.get(java.util.Calendar.MILLISECOND) == 0)
                && (dtEnd.get(java.util.Calendar.SECOND) == 0) && (dtEnd.get(java.util.Calendar.MINUTE) == 0)
                && (dtEnd.get(java.util.Calendar.HOUR_OF_DAY) == 0));

        // hack: if start and end time is at 00:00:00:000 it is
        // an all day event
        allDayEvent = startAtNullOClock && endAtNullOClock;

        return allDayEvent;

    }/*from w  w  w.j av a 2  s  .c  o  m*/
}

Related

  1. getWorkingDay(Calendar beginDate, Calendar endDate)
  2. getWorkingDay(Calendar d1, Calendar d2)
  3. incrementDay(Calendar cal)
  4. incrementOneDay(Calendar calendar)
  5. isAfterDay(Calendar cal1, Calendar cal2)
  6. isBusinessDay(Calendar cal)
  7. isDayAfter(Calendar calendar, Calendar baseCalendar)
  8. isDSTChangeDay(Calendar cal)
  9. isEndOfDay(Calendar calendar)