posixt-getters {clock}R Documentation

Getters: date-time

Description

These are POSIXct/POSIXlt methods for the getter generics.

For more advanced component extraction, convert to the calendar type that you are interested in.

Usage

## S3 method for class 'POSIXt'
get_year(x)

## S3 method for class 'POSIXt'
get_month(x)

## S3 method for class 'POSIXt'
get_day(x)

## S3 method for class 'POSIXt'
get_hour(x)

## S3 method for class 'POSIXt'
get_minute(x)

## S3 method for class 'POSIXt'
get_second(x)

Arguments

x

⁠[POSIXct / POSIXlt]⁠

A date-time type to get the component from.

Value

The component.

Examples

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)

[Package clock version 0.7.0 Index]