Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static boolean isDay() { Calendar calendar = Calendar.getInstance(); int time = calendar.get(Calendar.HOUR_OF_DAY); return time >= 6 && time < 18; } }