Skip to contents

Extract Year/Month/Day from date string

Usage

year(x)

month(x)

day(x)

Arguments

x

Character or Date vector.

Value

Numeric vector

Examples

D = c("2021-1-1", "2015/9/25")
year(D)
#> [1] 2021 2015
month(D)
#> [1] 1 9
day(D)
#> [1]  1 25