Class JulianDate
java.lang.Object
org.shredzone.commons.suncalc.util.JulianDate
This class contains a Julian Date representation of a date.
Objects are immutable and threadsafe.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionatHour
(double hour) Returns aJulianDate
of the current date and the given hour.atJulianCentury
(double jc) Returns aJulianDate
of the given Julian century.atModifiedJulianDate
(double mjd) Returns aJulianDate
of the given modified Julian date.Returns thisJulianDate
asCalendar
object.getDate()
Returns thisJulianDate
asDate
object.Returns thisJulianDate
as truncatedDate
object.double
Returns the Greenwich Mean Sidereal Time of this Julian Date.double
Returns the Julian Centuries.double
Returns the Modified Julian Date.double
Returns the earth's true anomaly of the current date.toString()
-
Constructor Details
-
JulianDate
Creates a newJulianDate
.- Parameters:
cal
-Calendar
to use. Do not modify this object after invocation.
-
-
Method Details
-
atHour
Returns aJulianDate
of the current date and the given hour.- Parameters:
hour
- Hour of this date. This is a floating point value. Fractions are used for minutes and seconds.- Returns:
JulianDate
instance.
-
atModifiedJulianDate
Returns aJulianDate
of the given modified Julian date.- Parameters:
mjd
- Modified Julian Date- Returns:
JulianDate
instance.- Since:
- 2.3
-
atJulianCentury
Returns aJulianDate
of the given Julian century.- Parameters:
jc
- Julian Century- Returns:
JulianDate
instance.- Since:
- 2.3
-
getDate
Returns thisJulianDate
asDate
object.- Returns:
Date
of thisJulianDate
.
-
getDateTruncated
Returns thisJulianDate
as truncatedDate
object.- Parameters:
unit
-TimeResultParameter.Unit
to truncate to- Returns:
- Rounded
Date
of thisJulianDate
. - Since:
- 2.3
-
getCalendar
Returns thisJulianDate
asCalendar
object.- Returns:
- New
Calendar
instance of thisJulianDate
.
-
getModifiedJulianDate
Returns the Modified Julian Date.- Returns:
- Modified Julian Date, UTC.
-
getJulianCentury
Returns the Julian Centuries.- Returns:
- Julian Centuries, based on J2000 epoch, UTC.
-
getGreenwichMeanSiderealTime
Returns the Greenwich Mean Sidereal Time of this Julian Date.- Returns:
- GMST
-
getTrueAnomaly
Returns the earth's true anomaly of the current date.A simple approximation is used here.
- Returns:
- True anomaly, in radians
-
toString
-