Extract parts of various Date-Time Objects
Extract the year, month or day, or all three (in yyyymmdd
form), or the quarter, from a jul, ti, or from any object that
jul() can handle.
ymd(x, ...) ## S3 method for class 'jul' ymd(x, ...) ## S3 method for class 'ssDate' ymd(x, ...) ## S3 method for class 'ti' ymd(x, offset = 1, ...) ## Default S3 method: ymd(x, ...) year(x, ...) quarter(x, ...) month(x, ...) day(x, ...)
x |
a |
... |
other args to be passed to the method called by the generic
function. |
offset |
for |
year, quarter, month and day call
ymd, and thus understand the same arguments as it does. The
default implementation ymd.default passes it's arguments to a
call to the function jul, so all of these functions work the
same way that function does.
ymd and it's variants return numeric objects in yyyymmdd form.
year, quarter, month and day return
numeric objects.
ymd() with no arguments returns today's yyyymmdd.
ymd() ## today's date and time weekFromNow <- ymd(today() + 7) ## today() returns a daily ti year(jul(today())) month(Sys.time()) ## create a monthly tis (Time Indexed Series) aTis <- tis(0, start = c(2000, 1), end = c(2004, 12), freq = 12) ymd(ti(aTis)) ## the yyyymmdd dates of the observations
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.