Convert dates in external formats (e.g. from MATLAB) to Date or POSIXct.
Usage
convert_date(x, type, fraction = FALSE, tz = "")
Value
A vector of class Date, or POSIXct if
fraction is TRUE.
Arguments
x
numeric
type
character: "excel", "excel1904", "matlab" and
"spss"/"pspp" are supported.
fraction
logical: should fractional dates (i.e. times) be used? Default is
FALSE.
tz
character: if fraction is TRUE, then what time zone is to be
assumed? Default is "", i.e. the local time zone.
Author
Enrico Schumann; type spss/pspp
suggested and based on a patch by J\"org Beyer
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).