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

mdy.Date

Convert numeric dates to Date object, and vice versa


Description

Convert numeric dates for month, day, and year to Date object, and vice versa.

Usage

mdy.Date(month, day, year, yearcut = 120)

Date.mdy(date)

is.Date(x)

Arguments

month

integer, month (1-12).

day

integer, day of the month (1-31, depending on the month).

year

integer, either 2- or 4-digit year. If two-digit number, will add 1900 onto it, depending on range.

yearcut

cutoff for method to know if to convert to 4-digit year.

date

A date value.

x

An object.

Details

Test if an object is a date.

More work may need to be done with yearcut and 2-digit years. Best to give a full 4-digit year.

Value

mdy.Date returns a Date object, and Date.mdy returns a list with integer values for month, day, and year. is.Date returns a single logical value.

See Also

Examples

mdy.Date(9, 2, 2013)

tmp <- mdy.Date(9, 2, 2013)
Date.mdy(tmp)

is.Date(tmp)

arsenal

An Arsenal of 'R' Functions for Large-Scale Statistical Summaries

v3.6.2
GPL (>= 2)
Authors
Ethan Heinzen [aut, cre], Jason Sinnwell [aut], Elizabeth Atkinson [aut], Tina Gunderson [aut], Gregory Dougherty [aut], Patrick Votruba [ctb], Ryan Lennon [ctb], Andrew Hanson [ctb], Krista Goergen [ctb], Emily Lundt [ctb], Brendan Broderick [ctb], Maddie McCullough [art]
Initial release
2021-02-16

We don't support your browser anymore

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