Java Calendar Time isFirstMorning(Calendar time, Calendar previous)

Here you can find the source of isFirstMorning(Calendar time, Calendar previous)

Description

Tests if this will be the first good morning trigger for a message.

License

Apache License

Parameter

Parameter Description
time the current time
previous the previous time

Return

true if the first time; otherwise false

Declaration

public static boolean isFirstMorning(Calendar time, Calendar previous) 

Method Source Code


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

import java.util.Calendar;

public class Main {
    /**/*www.jav a  2s.co m*/
     * Tests if this will be the first good morning trigger for a message.
     * 
     * @param time
     *            the current time
     * @param previous
     *            the previous time
     * @return true if the first time; otherwise false
     */
    public static boolean isFirstMorning(Calendar time, Calendar previous) {
        if (time == null || previous == null) {
            return false;
        }

        if (time.get(Calendar.YEAR) == previous.get(Calendar.YEAR)
                && time.get(Calendar.DAY_OF_YEAR) == previous.get(Calendar.DAY_OF_YEAR)
                && previous.get(Calendar.HOUR_OF_DAY) >= 6) {
            return false;
        }

        return true;
    }
}

Related

  1. getTimeZoneCalendar(final TimeZone timeZone)
  2. getTimezoneString(Calendar cal)
  3. hasTime(Calendar cal)
  4. hasTimePart(Calendar calendar)
  5. isEquals(Calendar startTime, Calendar timeCurrent, int type)
  6. isFuture(Calendar time)
  7. isMorning(Calendar time)
  8. isOverTime(Calendar lastTime, Calendar currentTime, Calendar begTime, Calendar endTime)
  9. isSameLocalTime(Calendar cal1, Calendar cal2)