-bottom

com.jivesoftware.util
Class JulianDate

java.lang.Object
  |
  +--com.jivesoftware.util.JulianDate

public class JulianDate
extends Object

An implementation of a class used represent a Julian date. One very important thing to note about this class is that months ARE NOT zero based (unlike the Java Date class).

Author:
Matt Welsh (matt@matt-welsh.com)

Field Summary
protected  double et
           
protected  GregorianCalendar gregorianDate
           
protected  double jd
           
protected  double paramU
           
 
Constructor Summary
JulianDate()
          Create a JD based on the current system time.
JulianDate(double jd)
          Create a JD based on the given time.
JulianDate(int iYear, int month, int day)
          Create a JD based on the given time.
JulianDate(int iYear, int month, int day, int hour, int min, int sec)
          Create a JD based on the given time.
 
Method Summary
static GregorianCalendar computeGregorianDate(double jDate)
          Compute a gregorian calendar date based on the given JD
static JulianDate getCurrentJD()
           
 double getEphemerisTime()
          Returns the equivelent ephemeris time equivelent of this date.
 GregorianCalendar getGregorianDate()
          Returns the equivelent date on the Gregorian calendar.
 double getJulianCentury()
          Computes the number of Julian Centuries from 1900 Jan 0.5
 double getJulianDate()
          Gets the julian date as a double.
 double getParamU()
          Gets the "U" parameter used in high precision planetary computations.
 String toString()
          Return this object as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jd

protected double jd

gregorianDate

protected GregorianCalendar gregorianDate

et

protected double et

paramU

protected double paramU
Constructor Detail

JulianDate

public JulianDate()
Create a JD based on the current system time.

JulianDate

public JulianDate(int iYear,
                  int month,
                  int day)
Create a JD based on the given time.
Parameters:
iYear - The year to use
month - The month to use (NOT ZERO BASED i.e. Jan = 1)
day - The day to use

JulianDate

public JulianDate(int iYear,
                  int month,
                  int day,
                  int hour,
                  int min,
                  int sec)
Create a JD based on the given time.
Parameters:
iYear - The year to use
month - The month to use (NOT ZERO BASED i.e. Jan = 1)
day - The day to use
hour - The hour to use
min - The minute to use
sec - The second to use

JulianDate

public JulianDate(double jd)
Create a JD based on the given time.
Parameters:
jd - The julian date as a double
Method Detail

getCurrentJD

public static JulianDate getCurrentJD()

getJulianDate

public double getJulianDate()
Gets the julian date as a double.
Returns:
The julian date as a double.

getJulianCentury

public double getJulianCentury()
Computes the number of Julian Centuries from 1900 Jan 0.5
Returns:
The number of Julian Centuries from 1900 Jan 0.5

getGregorianDate

public GregorianCalendar getGregorianDate()
Returns the equivelent date on the Gregorian calendar.
Returns:
the equivelent date on the Gregorian calendar.

getEphemerisTime

public double getEphemerisTime()
Returns the equivelent ephemeris time equivelent of this date. This is a more stable time scale than UT and is useful for high precision planetary computations.
Returns:
The ephemeris time representing this object.

getParamU

public double getParamU()
Gets the "U" parameter used in high precision planetary computations.
Returns:
The "U" parameter.

toString

public String toString()
Return this object as a String.
Overrides:
toString in class Object
Returns:
A String object representing this object.

computeGregorianDate

public static GregorianCalendar computeGregorianDate(double jDate)
                                              throws IllegalArgumentException
Compute a gregorian calendar date based on the given JD

-bottom