2011-01-14 4 views
2

私のアプリでは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)); 
+1

oops、sunrise @ '12:20'! – Nishant

答えて