Generate Dates

DESCRIPTION:
Generate a dates object from integer or character string representations of dates.

USAGE:
dates(x, format = "m/d/y", out.format, origin)
origin(date)

REQUIRED ARGUMENTS:
x:
a 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, i.e., number of days since an origin.
date:
an object of class "dates".

OPTIONAL ARGUMENTS:
format:
a character string giving the format for interpreting x when x is a vector or character strings. See the DETAILS section for the possible formats. Default is "m/d/y".
out.format:
a character string giving the format for printing the resulting dates object. Default is to use the same format as format.
origin:
a vector of length 3 specifying the date with respect to which Julian dates are computed. Default is c(month=1, day=1, year=1960), i.e., January 1, 1960.

VALUE:
The 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".

The origin function extracts the origin of an object of class "dates".


DETAILS:
The character strings for format and out.format can be any permutation of the characters d, m, and y, or the words day, month and year separated by a single character (or a space) delimiter. All 3 letters or words must be present. Thus "ymd", "d-m-y", "month day year", and "day month year" are all valid.

Using words rather than letters causes the month and year to be written out fully, rather than as two digit numbers. Using "mon" for the month will result in three-letter abbreviations for the month names.


SEE ALSO:
julian , months , seq.dates .

EXAMPLES:
tday <- dates("25-11-93", format="d-m-y", out="day mon year")
tday

# produces the following output: [1] 25 Nov 1993

origin(tday)

# produces the following output: month day year 1 1 1960