Convert a POSIXt time to a Julian day, using the method provided in Chapter 3 of reference 1. It should be noted that Meeus and other astronomical treatments use fractional days, whereas the present code follows the R convention of specifying days in whole numbers, with hours, minutes, and seconds also provided as necessary. Conversion is simple, as illustrated in the example for 1977 April 26.4, for which Meeus calculates julian day 2443259.9. Note that the R documentation for julian() suggests another formula, but the point of the present function is to match the other Meeus formulae, so that suggestion is ignored here.

julianDay(
t,
year = NA,
month = NA,
day = NA,
hour = NA,
min = NA,
sec = NA,
tz = "UTC"
)

## Arguments

t a time, in POSIXt format, e.g. as created by as.POSIXct(), as.POSIXlt(), or numberAsPOSIXct(). If this is provided, the other arguments are ignored. year, to be provided along with month, etc., if t is not provided. month, numbered with January being 1. day in month, starting at 1. hour of day. minute of hour second of hour timezone

## Value

A Julian-Day number, in astronomical convention as explained in Meeus.

## References

1. Meeus, Jean, 1982. Astronomical formulae for Calculators. Willmann-Bell. Richmond VA, USA. 201 pages

Other things related to astronomy: angle2hms(), eclipticalToEquatorial(), equatorialToLocalHorizontal(), julianCenturyAnomaly(), moonAngle(), siderealTime(), sunAngle(), sunDeclinationRightAscension()
Other things related to time: ctimeToSeconds(), julianCenturyAnomaly(), numberAsHMS(), numberAsPOSIXct(), secondsToCtime(), unabbreviateYear()

expect_equal(julianDay(t), 2443259.9) # example from Meeus