File: getDateOrigin.Rd

package info (click to toggle)
r-cran-openxlsx 4.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,328 kB
  • sloc: cpp: 1,867; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,030 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wrappers.R
\name{getDateOrigin}
\alias{getDateOrigin}
\title{Get the date origin an xlsx file is using}
\usage{
getDateOrigin(xlsxFile)
}
\arguments{
\item{xlsxFile}{An xlsx or xlsm file.}
}
\value{
One of "1900-01-01" or "1904-01-01".
}
\description{
Return the date origin used internally by an xlsx or xlsm file
}
\details{
Excel stores dates as the number of days from either 1904-01-01 or 1900-01-01. This function
checks the date origin being used in an Excel file and returns is so it can be used in \code{\link[=convertToDate]{convertToDate()}}
}
\examples{

## create a file with some dates
\dontrun{
write.xlsx(as.Date("2015-01-10") - (0:4), file = "getDateOriginExample.xlsx")
m <- read.xlsx("getDateOriginExample.xlsx")

## convert to dates
do <- getDateOrigin(system.file("extdata", "readTest.xlsx", package = "openxlsx"))
convertToDate(m[[1]], do)
}
}
\seealso{
\code{\link[=convertToDate]{convertToDate()}}
}
\author{
Alexander Walker
}