dates object from integer or character string
representations of dates.
dates(x, format = "m/d/y", out.format, origin, century) origin(date)
dates object, a character vector, or a numeric vector specifying
dates. If character, it must be in the format specified by the
format argument. If numeric, it specifies
Julian dates, that is, number of days since an origin.
"dates".
x when
x is
a vector or character strings.
See the DETAILS section for the possible formats.
Default is
"m/d/y".
dates
object.
Default is
"m/d/year".
c(month=1, day=1, year=1960), that is,
January 1, 1960.
dates function returns an object of class
"dates"; that is, an
object with a
format attribute determined by
out.format,
an
origin attribute as specified by the argument
origin
, and
class attribute
"dates".
origin function extracts the origin of an object of class
"dates".
The character strings for
format and
out.format can be any
permutation of the following characters:
"d" or
"day" (two digit number);
"m"
(two digit number, for example, 11),
"mon" (three-letter abbreviation, e.g.,
Nov) or
"month" (full month name, for example, November); and
"y",
"yy"
(two digit number, for example, 93) or
"yr",
"year"
(four digit number, for example, 1993),
separated by a single character (
"/",
".",
"-" or a space) delimiter
with special cases:
"mdy",
"dmy" and
"ymd". All 3 letters or words
must be present. The same separators must be used and consistent with those
in
x when
x is a character string.
Thus
"d-m-y",
"month day year", and
"day month year" are all valid.
Different separators can be specified in
out.format and the first one will
be used.
tday <- dates("23/7/04", format="d/m/y", out="day mon year")
tday
# produces the following output:
#[1] 23 Jul 2004
origin(tday)
# produces the following output:
#month day year
# 1 1 1960
dates("7/23/04", out="mon/d/year", century=1900)
# produces the following output:
#[1] Jul/23/1904