![]() |
SuperNOVAS v1.5
The NOVAS C library, made better
|
Various functions to convert between calendar dates and Julian days. More...
Functions | |
int | cal_date (double tjd, short *restrict year, short *restrict month, short *restrict day, double *restrict hour) |
This function will compute a broken down date on the astronomical calendar given the Julian day input. | |
double | julian_date (short year, short month, short day, double hour) |
Returns the Julian day for a given astronomical calendar date. | |
int | novas_day_of_week (double tjd) |
Returns the one-based ISO 8601 day-of-week index of a given Julian Date. | |
int | novas_day_of_year (double tjd, enum novas_calendar_type calendar, int *restrict year) |
Returns the one-based day index in the calendar year for a given Julian Date. | |
double | novas_jd_from_date (enum novas_calendar_type calendar, int year, int month, int day, double hour) |
Returns the Julian day for a given calendar date. | |
int | novas_jd_to_date (double tjd, enum novas_calendar_type calendar, int *restrict year, int *restrict month, int *restrict day, double *restrict hour) |
This function will compute a broken down date on the specified calendar for given the Julian day input. | |
Various functions to convert between calendar dates and Julian days.
int cal_date | ( | double | tjd, |
short *restrict | year, | ||
short *restrict | month, | ||
short *restrict | day, | ||
double *restrict | hour ) |
This function will compute a broken down date on the astronomical calendar given the Julian day input.
Input Julian day can be based on any UT-like time scale (UTC, UT1, TT, etc.) - output time value will have same basis.
NOTES:
The Gregorian calendar was introduced on 15 October 1582 only (corresponding to 5 October of the previously used Julian calendar). Prior to it this function returns Julian / Roman calendar dates, e.g. the day before the reform is 1582 October 4. You can use novas_jd_to_date()
instead to convert JD days to dates in specific calendars.
REFERENCES:
tjd | [day] Julian date | |
[out] | year | [yr] Astronomical calendar year. It may be NULL if not required. B.C. years are represented as <=0, i.e. 1 B.C. as 0 and X B.C. as (1 - X) |
[out] | month | [month] Astronomical calendar month [1:12]. It may be NULL if not required. |
[out] | day | [day] Day of the month [1:31]. It may be NULL if not required. |
[out] | hour | [h] Hour of day [0:24]. It may be NULL if not required. |
References NOVAS_ASTRONOMICAL_CALENDAR, and novas_jd_to_date().
double julian_date | ( | short | year, |
short | month, | ||
short | day, | ||
double | hour ) |
Returns the Julian day for a given astronomical calendar date.
Input time value can be based on any UT-like time scale (UTC, UT1, TT, etc.) - output Julian day will have the same basis.
NOTES:
The Gregorian calendar was introduced on 1582 October 15 only. Prior to that, astronomical dates are Julian/Roman dates, so the day before the reform was 1582 October 4. You can also use novas_jd_from_date()
to convert dates with more flexibility.
B.C. dates are indicated with years <=0 according to the astronomical and ISO 8601 convention, i.e., X B.C. as (1-X), so 45 B.C. as -44.
REFERENCES:
year | [yr] Astronomical calendar year. B.C. years can be simply represented as <=0, e.g. 1 B.C. as 0, and X B.C. as (1 - X). |
month | [month] Astronomical calendar month [1:12] |
day | [day] Astronomical day of month [1:31] |
hour | [hr] Hour of day [0:24] |
References NOVAS_ASTRONOMICAL_CALENDAR, and novas_jd_from_date().
int novas_day_of_week | ( | double | tjd | ) |
Returns the one-based ISO 8601 day-of-week index of a given Julian Date.
The ISO 8601 week begins on Monday, thus index 1 corresponds to Monday, while index 7 is a Sunday.
tjd | [day] Julian Date in the timescale of choice. (e.g. UTC-based if you want a UTC-based return value). |
References NOVAS_JD_J2000.
int novas_day_of_year | ( | double | tjd, |
enum novas_calendar_type | calendar, | ||
int *restrict | year ) |
Returns the one-based day index in the calendar year for a given Julian Date.
tjd | [day] Julian Date in the timescale of choice. (e.g. UTC-based if you want a UTC-based return value). | |
calendar | The type of calendar to use: NOVAS_ASTRONOMICAL_CALENDAR, NOVAS_GREGORIAN_CALENDAR, or NOVAS_ROMAN_CALENDAR. | |
[out] | year | [yr] Optional pointer to which to return the calendar year. It may be NULL if not required. |
References NOVAS_ASTRONOMICAL_CALENDAR, NOVAS_JD_START_GREGORIAN, novas_jd_to_date(), and NOVAS_ROMAN_CALENDAR.
double novas_jd_from_date | ( | enum novas_calendar_type | calendar, |
int | year, | ||
int | month, | ||
int | day, | ||
double | hour ) |
Returns the Julian day for a given calendar date.
Input time value can be based on any astronomical time scale (UTC, UT1, TT, etc.) - output Julian date will have the same basis.
The input date is the conventional calendar date, affected by the Gregorian calendar reform of
NOTES:
B.C. dates are indicated with years <=0 according to the astronomical and ISO 8601 convention, i.e., X B.C. as (1-X), so 45 B.C. as -44.
REFERENCES:
calendar | The type of calendar to use: NOVAS_ASTRONOMICAL_CALENDAR, NOVAS_GREGORIAN_CALENDAR, or NOVAS_ROMAN_CALENDAR. |
year | [yr] Calendar year. B.C. years can be simply represented as <=0, e.g. 1 B.C. as 0, and X B.C. as (1 - X). |
month | [month] Calendar month [1:12] |
day | [day] Day of month [1:31] |
hour | [hr] Hour of day [0:24] |
References NOVAS_ASTRONOMICAL_CALENDAR, NOVAS_GREGORIAN_CALENDAR, NOVAS_JD_START_GREGORIAN, and NOVAS_ROMAN_CALENDAR.
int novas_jd_to_date | ( | double | tjd, |
enum novas_calendar_type | calendar, | ||
int *restrict | year, | ||
int *restrict | month, | ||
int *restrict | day, | ||
double *restrict | hour ) |
This function will compute a broken down date on the specified calendar for given the Julian day input.
Input Julian day can be based on any astronomical time scale (UTC, UT1, TT, etc.) - output time value will have same basis.
NOTES:
REFERENCES:
tjd | [day] Julian day. | |
calendar | The type of calendar to use: NOVAS_ASTRONOMICAL_CALENDAR, NOVAS_GREGORIAN_CALENDAR, or NOVAS_ROMAN_CALENDAR. | |
[out] | year | [yr] Calendar year. B.C. years are represented as <=0, e.g. 1 B.C. as 0, and X B.C. as (1 - X). It may be NULL if not required. |
[out] | month | [month] Calendar month [1:12]. It may be NULL if not required. |
[out] | day | [day] Day of the month [1:31]. It may be NULL if not required. |
[out] | hour | [h] Hour of day [0:24]. It may be NULL if not required. |
References NOVAS_ASTRONOMICAL_CALENDAR, NOVAS_GREGORIAN_CALENDAR, NOVAS_JD_START_GREGORIAN, and NOVAS_ROMAN_CALENDAR.