| weekdays.datetimeoffset {datetimeoffset} | R Documentation |
Additional datetime extractors
Description
Additional datetime extractors for datetimeoffset() objects.
Usage
## S3 method for class 'datetimeoffset'
weekdays(x, abbreviate = FALSE)
## S3 method for class 'datetimeoffset'
months(x, abbreviate = FALSE)
## S3 method for class 'datetimeoffset'
quarters(x, ...)
## S3 method for class 'datetimeoffset'
julian(x, origin = as.Date("1970-01-01"), ...)
Arguments
x |
A |
abbreviate |
Logical vector for whether the names should be abbreviated |
... |
Ignored |
origin |
Length one datetime of origin |
Details
We implement datetimeoffset() support for the following S3 methods from base:
-
weekdays() -
months() -
quarters() -
julian()
There is also datetimeoffset() support for the following methods from lubridate:
-
isoyear()andepiyear() -
quarter()andsemester() -
week(),isoweek(), andepiweek() -
wday()andwday<-() -
qday()andqday<-() -
yday()andyday<-() -
am()andpm() -
days_in_month() -
dst() -
leap_year()
Value
weekdays(), months(), quarters(), julian() return character vectors.
See base::weekdays() for more information.
Examples
dto <- datetimeoffset_now()
print(dto)
weekdays(dto)
months(dto)
quarters(dto)
julian(dto)
if (require("lubridate")) {
cat("`isoyear(dto)`: ", isoyear(dto), "\n")
cat("`epiyear(dto)`: ", epiyear(dto), "\n")
cat("`semester(dto)`: ", semester(dto), "\n")
cat("`quarter(dto)`: ", quarter(dto), "\n")
cat("`week(dto)`: ", week(dto), "\n")
cat("`isoweek(dto)`: ", isoweek(dto), "\n")
cat("`epiweek(dto)`: ", epiweek(dto), "\n")
cat("`wday(dto)`: ", wday(dto), "\n")
cat("`qday(dto)`: ", qday(dto), "\n")
cat("`yday(dto)`: ", yday(dto), "\n")
cat("`am(dto)`: ", am(dto), "\n")
cat("`pm(dto)`: ", pm(dto), "\n")
cat("`days_in_month(dto)`: ", days_in_month(dto), "\n")
cat("`dst(dto)`: ", dst(dto), "\n")
cat("`leap_year(dto)`: ", leap_year(dto), "\n")
}
[Package datetimeoffset version 0.3.1 Index]