Skip to contents

Create a Gregorian date object.

Usage

gregorian(year = integer(), month = integer(), day = integer())

as_gregorian(date, ...)

Arguments

year

A numeric vector of years

month

A numeric vector of months

day

A numeric vector of days

date

Vector of dates on some calendar

...

Additional arguments not currently used

Value

A gregorian vector object

Examples

gregorian(2025, 4, 19:30)
#> <gregorian[12]>
#>  [1] 2025-04-19 2025-04-20 2025-04-21 2025-04-22 2025-04-23 2025-04-24
#>  [7] 2025-04-25 2025-04-26 2025-04-27 2025-04-28 2025-04-29 2025-04-30
as_gregorian("2016-01-01")
#> <gregorian[1]>
#> [1] 2016-01-01
as_gregorian(Sys.Date())
#> <gregorian[1]>
#> [1] 2025-05-04
tibble::tibble(
  x = seq(as.Date("2025-01-01"), as.Date("2025-12-31"), by = "day"),
  y = as_gregorian(x)
)
#> # A tibble: 365 × 2
#>    x                   y
#>    <date>          <Gre>
#>  1 2025-01-01 2025-01-01
#>  2 2025-01-02 2025-01-02
#>  3 2025-01-03 2025-01-03
#>  4 2025-01-04 2025-01-04
#>  5 2025-01-05 2025-01-05
#>  6 2025-01-06 2025-01-06
#>  7 2025-01-07 2025-01-07
#>  8 2025-01-08 2025-01-08
#>  9 2025-01-09 2025-01-09
#> 10 2025-01-10 2025-01-10
#> # ℹ 355 more rows