Java Calendar Time isMorning(Calendar time)

Here you can find the source of isMorning(Calendar time)

Description

Tests if a time is during the morning.

License

Apache License

Parameter

Parameter Description
time the time

Return

true if during the morning; otherwise false

Declaration

public static boolean isMorning(Calendar time) 

Method Source Code


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

import java.util.Calendar;

public class Main {
    /**//from   w  ww  .  j a  v a 2s .c  o m
     * Tests if a time is during the morning.
     * 
     * @param time
     *            the time
     * @return true if during the morning; otherwise false
     */
    public static boolean isMorning(Calendar time) {
        if (time == null) {
            return false;
        }

        int hour = time.get(Calendar.HOUR_OF_DAY);
        return hour >= 6 && hour <= 10;
    }
}

Related

  1. hasTime(Calendar cal)
  2. hasTimePart(Calendar calendar)
  3. isEquals(Calendar startTime, Calendar timeCurrent, int type)
  4. isFirstMorning(Calendar time, Calendar previous)
  5. isFuture(Calendar time)
  6. isOverTime(Calendar lastTime, Calendar currentTime, Calendar begTime, Calendar endTime)
  7. isSameLocalTime(Calendar cal1, Calendar cal2)
  8. isSameLocalTime(Calendar cal1, Calendar cal2)
  9. isSameTime(final Calendar aCal1, final Calendar aCal2)