td: Consistent day numbering

Description Usage Arguments Details Value See Also Examples

Description

Consistent day numbering

Usage

1
td(d = 1L, m = 1L, y)

Arguments

d

numeric []; day of month

m

numeric []; month number

y

numeric []; year

Details

A consistent numbering system for days, designed to use the same numbering as MS Office Excel. Each date has a set number, for example 36526 for 1/1/2000.

Works for any date, using consistent negative values for dates before 30/12/1899. Every 4th year is a leap year, but every 100th year is not a leap year, but every 400th year is a leap year. 30/12/1899 is day 0, whereas MS Office starts with 1/1/1900 as day 1, but includes 29/1/1900, which in fact never happened. Therefore the numbering is the same as MS Office Excel after 1/3/1900.

Artificially vectorised with Vectorize.

Value

numeric []

See Also

invtd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# day 0
td(30, 12, 1899)

# negative before the 20th century
td(1, 7, 1890)

# unreal dates return NA
td(29, 2, 1900)
td(40, 3, 2000)

# artificially vectorised with Vectorize
td(1:3, 3, 2000)
td(1, 7, seq(1960, 2000, 5))

# can find number of days between dates easily
td(1, 1, 2000) - td(1, 1, 1900)

CJBarry/td documentation built on May 6, 2019, 9:25 a.m.

Related to td in CJBarry/td...