私のアプリではsunriseCalc-libを使用しています。 このlibはsunrise-timeを計算し、このような文字列を返します12:20。 現在時刻が日の出時刻より遅いかどうかを確認できますか? は、私は、次のコードを持って:あなたはDateオブジェクトがすでにちょうどそれらのオブジェクトにbefore()
とafter()
メソッドを使用している場合はサンライズ/チェック時間
Location location = new Location("52.3496752", "4.6211921");
DateFormat newDateFormat = new SimpleDateFormat("HH:mm");
SunriseSunsetCalculator calculator = new SunriseSunsetCalculator(location, "Europe/Berlin");
Calendar date = Calendar.getInstance();
Date dawn = newDateFormat.parse(calculator.getOfficialSunriseForDate(date));
Date dusk = newDateFormat.parse(calculator.getOfficialSunsetForDate(date));
oops、sunrise @ '12:20'! – Nishant