as_date {calcal} | R Documentation |
Create a new date vector or convert a date vector to a new calendar
Description
New dates can be calculated using new_date()
for any calendar. Dates can be
converted from one calendar to another using as_date()
. as_date()
also works
with the native R Date
class and several other classes. When applied to
integers, the conversion is from the RD day number (with day 1 being
01-01-01 on the Gregorian calendar).
Usage
as_date(date, calendar)
new_date(..., calendar)
Arguments
date |
Date vector on some calendar |
calendar |
Target calendar of class "calendar" |
... |
Named arguments denoting the granularities required for |
Value
A date vector of class "rdvec" with the specified calendar.
Examples
april2025 <- new_date(year = 2025, month = 4, day = 1:30, calendar = cal_gregorian)
as_date(april2025, calendar = cal_iso)
[Package calcal version 1.0.0 Index]