Java Calendar Time isSleepTime(Calendar calendar, String sleepTimeStart, String sleepTimeEnd)

Here you can find the source of isSleepTime(Calendar calendar, String sleepTimeStart, String sleepTimeEnd)

Description

is Sleep Time

License

Open Source License

Declaration

public static boolean isSleepTime(Calendar calendar, String sleepTimeStart, String sleepTimeEnd) 

Method Source Code


//package com.java2s;
import java.util.Calendar;

public class Main {
    public static boolean isSleepTime(Calendar calendar, String sleepTimeStart, String sleepTimeEnd) {
        int sleepStart = Integer.parseInt(sleepTimeStart);
        int sleepEnd = Integer.parseInt(sleepTimeEnd);
        int hourofday = calendar.get(Calendar.HOUR_OF_DAY);
        return hourofday >= sleepStart || hourofday <= sleepEnd;
    }/*ww  w.  j a v  a  2s.co  m*/
}

Related

  1. isMorning(Calendar time)
  2. isOverTime(Calendar lastTime, Calendar currentTime, Calendar begTime, Calendar endTime)
  3. isSameLocalTime(Calendar cal1, Calendar cal2)
  4. isSameLocalTime(Calendar cal1, Calendar cal2)
  5. isSameTime(final Calendar aCal1, final Calendar aCal2)
  6. isTime0(final Calendar calendar)
  7. isWorkTime(Calendar calendar, String workTimeStart, String workTimeEnd)
  8. maximizeTimeFields(final Calendar calendar)
  9. merge(Calendar date, Calendar time)