Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

date.mdy

Convert from Julian Dates to Month, Day, and Year


Description

Convert a vector of Julian dates to a list of vectors with the corresponding values of month, day and year, and optionally weekday.

Usage

date.mdy(sdate, weekday = FALSE)

Arguments

sdate

a Julian date value, as returned by mdy.date(), number of days since 1/1/1960.

weekday

if TRUE, then the returned list also will contain the day of the week (Sunday=1, Saturday=7).

Value

A list with components month, day, and year.

References

Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P. (1992). Numerical Recipes: The Art of Scientific Computing (Second Edition). Cambridge University Press.

Examples

day <- 7
temp <- date.mdy(mdy.date(month = 7, day = day, year = 1960))
## Check for illegal dates, such as 29 Feb in a non leap year
if (temp$day != day) {
  cat("Some illegal dates\n")
} else {
  cat("All days are legal\n")
}

date

Functions for Handling Dates

v1.2-39
GPL-2
Authors
Terry Therneau [aut], Thomas Lumley [trl] (R port), Kjetil Halvorsen [trl] (R port), Kurt Hornik [trl, ctb, cre] (<https://orcid.org/0000-0003-4198-9911>, R port), R Core Team [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.