Learn R Programming

str2str (version 1.0.0)

is.POSIXlt: Test for a POSIXlt object

Description

is.POSIXlt returns whether an object is a POSIXlt object (aka has class = "POSIXlt").

Usage

is.POSIXlt(x)

Value

TRUE is x has class "POSIXlt" and FALSE if x does not have class "POSIXlt".

Arguments

x

an object.

Examples

Run this code
time <- as.POSIXlt("2021-05-24 21:49:11", tz = "America/New_York",
   format = "%Y-%m-%d %H:%M:%OS") # as.POSIXlt.character
is.POSIXlt(time)
class(time) <- append(class(time), "extra_class")
is.POSIXlt(time) # classes other than POSIXlt are allowed
is.POSIXlt(list(time)) # returns FALSE

Run the code above in your browser using DataLab