convert_date {datetimeutils} | R Documentation |
Convert Various Formats to Date
Description
Convert dates in external formats (e.g. from MATLAB) to Date or POSIXct.
Usage
convert_date(x, type, fraction = FALSE, tz = "")
Arguments
x |
numeric |
type |
character: |
fraction |
logical: should fractional dates (i.e. times) be used? Default is
|
tz |
character: if fraction is TRUE, then what time zone is to be
assumed? Default is |
Details
Convert the numeric representation of a date to class
Date
. Note that different versions of Excel use
different origins: 1900-01-01 or 1904-01-01. For the latter, set
type
to "excel1904"
.
For the former, convert_date
uses 1899-12-31 because Excel
considers 1900 a leap year (which it is not).
So dates before 1 March 1900 are probably wrong (off by one day).
Value
A vector of class Date
, or POSIXct
if
fraction is TRUE
.
Author(s)
Enrico Schumann; type spss
/pspp
suggested and based on a patch by J\"org Beyer
See Also
Examples
convert_date(40000, "excel")