Android Date Time Get isNight()

Here you can find the source of isNight()

Description

is Night

Declaration

public static boolean isNight() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static boolean isNight() {
        SimpleDateFormat sdf = new SimpleDateFormat("HH");
        int hour = Integer.valueOf(sdf.format(new Date()));

        return hour > 18 || hour < 6;
    }/*from w  w w . java 2s  . c  o m*/
}

Related

  1. getCurDateTime()
  2. getCurDateTime(String pattern)
  3. getCurrentDate(String time)
  4. getCurrentDate(long time)
  5. getDatetime()
  6. getDateDifference(Date thenDate)
  7. currentTimeLabel()
  8. currentTimeToString(int format, String delimiter)
  9. getDate()