Learn R Programming

whapi (version 0.0.2)

whapi_to_posixct: Convert numeric timestamp to POSIXct (UTC)

Description

Utility function to convert a Unix timestamp (seconds since 1970-01-01 UTC) into a POSIXct object. Uses lubridate::as_datetime() for readability and consistency with the tidyverse ecosystem.

Usage

whapi_to_posixct(x)

Value

A POSIXct object (in UTC) or NA if x is NULL or NA.

Arguments

x

A numeric or character vector representing a Unix timestamp (seconds since epoch). Can be NULL or NA.

See Also

Examples

Run this code
# Single timestamp
whapi_to_posixct(1756426418)

# Vector of timestamps (with NA)
whapi_to_posixct(c(1756426418, NA))

# Character input
whapi_to_posixct("1756426418")

Run the code above in your browser using DataLab