public final class SunriseSunset extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SunriseSunset.DayPeriod |
Modifier and Type | Field and Description |
---|---|
static double |
SUN_ALTITUDE_ASTRONOMICAL_TWILIGHT
The altitude of the sun (solar elevation angle) at the moment of astronomical twilight: -18.0
|
static double |
SUN_ALTITUDE_CIVIL_TWILIGHT
The altitude of the sun (solar elevation angle) at the moment of civil twilight: -6.0
|
static double |
SUN_ALTITUDE_NAUTICAL_TWILIGHT
The altitude of the sun (solar elevation angle) at the moment of nautical twilight: -12.0
|
static double |
SUN_ALTITUDE_SUNRISE_SUNSET
The altitude of the sun (solar elevation angle) at the moment of sunrise or sunset: -0.833
|
Modifier and Type | Method and Description |
---|---|
static Calendar[] |
getAstronomicalTwilight(Calendar day,
double latitude,
double longitude)
Calculate the astronomical twilight time for the given date and given location.
|
static Calendar[] |
getCivilTwilight(Calendar day,
double latitude,
double longitude)
Calculate the civil twilight time for the given date and given location.
|
static long |
getDayLength(Calendar calendar,
double latitude,
double longitude) |
static SunriseSunset.DayPeriod |
getDayPeriod(Calendar calendar,
double latitude,
double longitude) |
static Calendar |
getGregorianDate(double julianDate)
Convert a Julian date to a Gregorian date.
|
static double |
getJulianDate(Calendar gregorianDate)
Convert a Gregorian calendar date to a Julian date.
|
static Calendar[] |
getNauticalTwilight(Calendar day,
double latitude,
double longitude)
Calculate the nautical twilight time for the given date and given location.
|
static Calendar |
getSolarNoon(Calendar day,
double latitude,
double longitude)
Calculate the solar noon time for the given date and given location.
|
static Calendar[] |
getSunriseSunset(Calendar day,
double latitude,
double longitude)
Calculate the sunrise and sunset times for the given date and given
location.
|
static Calendar[] |
getSunriseSunset(Calendar day,
double latitude,
double longitude,
double sunAltitude)
Calculate the sunrise and sunset times for the given date, given
location, and sun altitude.
|
static boolean |
isAstronomicalTwilight(Calendar calendar,
double latitude,
double longitude) |
static boolean |
isAstronomicalTwilight(double latitude,
double longitude) |
static boolean |
isCivilTwilight(Calendar calendar,
double latitude,
double longitude) |
static boolean |
isCivilTwilight(double latitude,
double longitude) |
static boolean |
isDay(Calendar calendar,
double latitude,
double longitude) |
static boolean |
isDay(double latitude,
double longitude) |
static boolean |
isNauticalTwilight(Calendar calendar,
double latitude,
double longitude) |
static boolean |
isNauticalTwilight(double latitude,
double longitude) |
static boolean |
isNight(Calendar calendar,
double latitude,
double longitude) |
static boolean |
isNight(double latitude,
double longitude) |
static boolean |
isTwilight(Calendar calendar,
double latitude,
double longitude) |
static boolean |
isTwilight(double latitude,
double longitude) |
public static final double SUN_ALTITUDE_SUNRISE_SUNSET
public static final double SUN_ALTITUDE_CIVIL_TWILIGHT
public static final double SUN_ALTITUDE_NAUTICAL_TWILIGHT
public static final double SUN_ALTITUDE_ASTRONOMICAL_TWILIGHT
public static double getJulianDate(Calendar gregorianDate)
gregorianDate
- Gregorian date in any time zone.public static Calendar getGregorianDate(double julianDate)
julianDate
- The date to convertpublic static Calendar[] getCivilTwilight(Calendar day, double latitude, double longitude)
day
- The day for which to calculate civil twilightlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static Calendar[] getNauticalTwilight(Calendar day, double latitude, double longitude)
day
- The day for which to calculate nautical twilightlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static Calendar[] getAstronomicalTwilight(Calendar day, double latitude, double longitude)
day
- The day for which to calculate astronomical twilightlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static Calendar[] getSunriseSunset(Calendar day, double latitude, double longitude)
day
- The day for which to calculate sunrise and sunsetlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static Calendar[] getSunriseSunset(Calendar day, double latitude, double longitude, double sunAltitude)
day
- The day for which to calculate sunrise and sunsetlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)sunAltitude
- the angle between the horizon and the center of the sun's disc.public static Calendar getSolarNoon(Calendar day, double latitude, double longitude)
day
- The day for which to calculate sunrise and sunsetlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isDay(double latitude, double longitude)
latitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isDay(Calendar calendar, double latitude, double longitude)
calendar
- a datetimelatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isNight(double latitude, double longitude)
latitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isNight(Calendar calendar, double latitude, double longitude)
calendar
- a datetimelatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isCivilTwilight(double latitude, double longitude)
latitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isCivilTwilight(Calendar calendar, double latitude, double longitude)
calendar
- the datetime for which to determine if it's civil twilight in the given locationlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isNauticalTwilight(double latitude, double longitude)
latitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isNauticalTwilight(Calendar calendar, double latitude, double longitude)
calendar
- the datetime for which to determine if it's nautical twilight in the given locationlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isAstronomicalTwilight(double latitude, double longitude)
latitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isAstronomicalTwilight(Calendar calendar, double latitude, double longitude)
calendar
- the datetime for which to determine if it's astronomical twilight in the given locationlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isTwilight(double latitude, double longitude)
latitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)public static boolean isTwilight(Calendar calendar, double latitude, double longitude)
latitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)calendar
- the given datetime to check for twilightpublic static SunriseSunset.DayPeriod getDayPeriod(Calendar calendar, double latitude, double longitude)
public static long getDayLength(Calendar calendar, double latitude, double longitude)
calendar
- the datetime for which to determine the day lengthlatitude
- the latitude of the location in degrees.longitude
- the longitude of the location in degrees (West is negative)Copyright © 2013–2017. All rights reserved.