parse_unix_time: Function to conveniently parse a vector of unix time to a...

View source: R/lubridate_supplements.R

parse_unix_timeR Documentation

Function to conveniently parse a vector of unix time to a POSIXct date vector.

Description

Function to conveniently parse a vector of unix time to a POSIXct date vector.

Usage

parse_unix_time(x, tz = "UTC", origin = "1970-01-01")

Arguments

x

An integer- or numeric-vector of unix times.

tz

Time-zone string. parse_unix_time defaults to "UTC".

origin

Origin of epoch. By definition, unix time is "1970-01-01", but other epochs are in use.

Value

A POSIXct vector with the length of x.

Author(s)

Stuart K. Grange

Examples


# A vector
unix_time_vector <- c(1460034000, 1460034703)

# Parse time, will be in UTC time-zone
parse_unix_time(unix_time_vector)

# Or in Berlin's time-zone
parse_unix_time(unix_time_vector, tz = "Europe/Berlin")


wacl-york/waclr documentation built on Dec. 8, 2022, 7:05 p.m.