date2num: Conversion between Dates and Their Integer Representations

View source: R/other.R

date2numR Documentation

Conversion between Dates and Their Integer Representations

Description

date2num and num2date support conversion between tind dates and integer representations of dates (days since ...) found in different software packages.

Usage

date2num(x, format)

num2date(x, format)

Arguments

x

a tind with dates or an integer vector.

format

a character value determing numeric representation of date; currently, the following are supproted: "R", "MATLAB", "Excel", "SAS", "JDN" (Julian Day Number).

Value

date2num returns an integer vector and num2date returns tind representing dates.

See Also

jdn for description of Julian Day Numbers.

Examples

(td <- today())
fmts <- c("R", "MATLAB", "Excel", "SAS", "JDN")
(n <- sapply(fmts, function(fmt) date2num(td, fmt)))
lapply(fmts, function(fmt) num2date(n[fmt], fmt))


tind documentation built on Dec. 28, 2025, 1:06 a.m.