1\name{day.of.week} 2\alias{day.of.week} 3\alias{julian.default} 4\alias{leap.year} 5\alias{month.day.year} 6\title{ 7 Convert between Julian and Calendar Dates 8} 9\description{ 10 Utility functions to convert between Julian dates (numbers of days 11 since an origin, by default 1970-01-01) and calendar dates given by 12 year, month, and day within the month. 13} 14\usage{ 15\method{julian}{default}(x, d, y, origin., \dots) 16month.day.year(jul, origin.) 17leap.year(y) 18day.of.week(month, day, year) 19} 20\arguments{ 21 \item{x, month}{vector of month numbers.} 22 \item{d, day}{vector of day numbers.} 23 \item{y, year}{vector of years.} 24 \item{jul}{vector of Julian Dates, i.e., number of days since 25 \code{origin.}.} 26 \item{origin.}{vector specifying the origin as month, day, and year. 27 If missing, it defaults to \code{getOption("chron.origin")} if this 28 is non-null, otherwise 29 \code{c(month = 1, day = 1, year = 1970)}.} 30 \item{\dots}{further arguments to be passed to or from methods.} 31} 32\value{ 33 A vector of Julian dates (number of days since \code{origin.}) when 34 \code{julian()} is called, or a list with members \code{month}, 35 \code{day}, \code{year} corresponding to the input Julian dates if 36 \code{month.day.year()} is called. \code{leap.year()} returns a 37 logical vector indicating whether the corresponding year is a leap 38 year. 39 \code{day.of.week()} returns a number between 0 and 6 to specify day 40 of the week--0 refers to Sunday. 41 42 These functions were taken from Becker, Chambers, and Wilks (1988), 43 and were slightly modified to take \code{chron} and \code{dates} 44 objects; some also take the extra argument \code{origin.}. 45 %The original functions are stored in the \code{library(example)}. 46} 47\seealso{ 48 \code{\link{chron}}, 49 \code{\link{dates}}, 50 \code{\link{times}} 51} 52\examples{ 53julian(1, 1, 1970) 54# [1] 0 55unlist(month.day.year(0)) 56# month day year 57# 1 1 1970 58} 59\keyword{chron} 60