powered by
These are POSIXct/POSIXlt methods for the getter generics.
get_year() returns the Gregorian year.
get_year()
get_month() returns the month of the year.
get_month()
get_day() returns the day of the month.
get_day()
There are sub-daily getters for extracting more precise components, up to a precision of seconds.
For more advanced component extraction, convert to the calendar type that you are interested in.
# S3 method for POSIXt get_year(x)# S3 method for POSIXt get_month(x)# S3 method for POSIXt get_day(x)# S3 method for POSIXt get_hour(x)# S3 method for POSIXt get_minute(x)# S3 method for POSIXt get_second(x)
# S3 method for POSIXt get_month(x)
# S3 method for POSIXt get_day(x)
# S3 method for POSIXt get_hour(x)
# S3 method for POSIXt get_minute(x)
# S3 method for POSIXt get_second(x)
The component.
[POSIXct / POSIXlt]
A date-time type to get the component from.
x <- as.POSIXct("2019-01-01", tz = "America/New_York") x <- add_days(x, 0:5) x <- set_second(x, 10:15) get_day(x) get_second(x)
Run the code above in your browser using DataLab