Skip to content

Epoch

Source code

Description

Get the time passed since the Unix EPOCH in the give time unit.

Usage

<Expr>$dt$epoch(tu = c("us", "ns", "ms", "s", "d"))

Arguments

tu string option either ‘ns’, ‘us’, ‘ms’, ‘s’ or ‘d’

Details

ns and perhaps us will exceed integerish limit if returning to R as flaot64/double.

Value

Expr of epoch as UInt32

Examples

library(polars)

as_polars_series(as.Date("2022-1-1"))$dt$epoch("ns")
#> polars Series: shape: (1,)
#> Series: '' [i64]
#> [
#>  1640995200000000000
#> ]
as_polars_series(as.Date("2022-1-1"))$dt$epoch("ms")
#> polars Series: shape: (1,)
#> Series: '' [i64]
#> [
#>  1640995200000
#> ]
as_polars_series(as.Date("2022-1-1"))$dt$epoch("s")
#> polars Series: shape: (1,)
#> Series: '' [i64]
#> [
#>  1640995200
#> ]
as_polars_series(as.Date("2022-1-1"))$dt$epoch("d")
#> polars Series: shape: (1,)
#> Series: '' [i32]
#> [
#>  18993
#> ]