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 can be used.

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")


skgrange/threadr documentation built on May 11, 2024, 12:16 p.m.