Convert between Julian and Calendar Dates
Utility functions to convert between Julian dates (numbers of days since an origin, by default 1970-01-01) and calendar dates given by year, month, and day within the month.
julian(m, d, y, origin = c(month = 1, day = 1, year = 1970)) month.day.year(jul, origin = c(month = 1, day = 1, year = 1970)) leap.year(y) day.of.week(month, day, year)
- vector of month numbers.
- vector of day numbers.
- vector of years.
- vector of Julian Dates, i.e., number of days since
- vector specifying the origin as month, day, and year.
If missing, it defaults to
getOption("chron.origin")if this is non-null, otherwise
c(month = 1, day = 1, year = 1970).
- A vector of Julian dates (number of days since
julian()is called, or a list with members
yearcorresponding to the input Julian dates if
leap.year()returns a logical vector indicating whether the corresponding year is a leap year.
day.of.week()returns a number between 0 and 6 to specify day of the week--0 refers to Sunday.
These functions were taken from Becker, Chambers, and Wilks (1988), and were slightly modified to take
datesobjects; some also take the extra argument
julian(1, 1, 1970) #  0 unlist(month.day.year(0)) # month day year # 1 1 1970