Class CalendarDate


Whenever you need additional information about an epoch as defined by the class JulianTime you may introduce another class called CalendarDate. There already exists a predefined class Date in Java and it does nearly all you may expect it to do. At least as long as you stay within the era of the Gregorian Calendar, which is valid since 15th of October, 1582. In Astronomy you often have to deal with epochs before that date. As you've already seen when reading about class JulianTime there exists a simple enumeration technique, called the julian date or julian day number. Joseph Justus Scaliger (1540-1609) proposed this kind of astronomical date starting at the first of January in the year 4713 before Christ at noon (!). He named it "Julian Day" to honor his father Julius Cesar Scaliger.

CalendarDate extends JulianTime. That means, class CalendarDate inherits data and methods from class JulianTime. In addition class CalendarDate contains data describing calendar date by strings and numbers. Information about the day of the year, the week of the year, the name of the day and the date of Easter is present too.


public class CalendarDate extends JulianTime
 
Data of class CalendarDate
String calendardate; Date i.e. 14.12.2002
String calendartime; Time i.e 14:12:20.02
int day; day of date i.e. 14
int month; month of date i.e 12
long year; year of date i.e.2002
int hour; hour of time i.e. 14
int minute; minute of time i.e. 12
double second; second of time i.e. 20.02
String dateinfo; additional information i.e. Saturday, 14.12.2002, 348. day of year, 49. week of year
String eastersunday; date of Easter i.e. 31.3.2002
String dayofweek; name of day i.e. Saturday
 
Constructors of class CalendarDate
public CalendarDate (); Today's date and time
public CalendarDate (double epoch); Date from julian day with fraction of day
public CalendarDate (JulianTime t); Date from JulianTime
public CalendarDate (String date, String time); Date from calendar date and time
 
Methods of class CalendarDate
Set Like set of class JulianTime plus setting of additional data
public void set ();
public void set (long day, double sek);
public void set (double epoch);
public void set (JulianTime t);
public void set (String date, String time);
public void set (int day, int month, long year, int hour, int minute, double second);
public void set (CalendarDate D);
Access Methods Access additional data
public String date (); { return calendardate; } 
public String time (); { return calendartime; } 
public int day (); { return day; } 
public int month (); { return month; } 
public long year (); { return year; } 
public int hour (); { return hour; } 
public int minute (); { return minute; } 
public double second (); { return second; } 
Info Methods Access additional information
public String dateInfo (); set and return dateinfo
public int daynumberOfWeek (); 0=Sunday, 1=Monday, ..., 6=Saturday
public String dayOfWeek (); Sunday, Monday, ... (set and return dayofweek)
public int dayOfYear (); day of the year
public int weekOfYear (); week of the year
public boolean leapYear (); leap year (true or false)
public String dateOfEaster (); date of Easter (set and return eastersunday)

Back Dieter Egger, Last Update 1997-06-27