Extract date from date(time)
Description
Extract date from date(time)
Usage
<Expr>$dt$date()
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(
datetime = as.POSIXct(c("1978-1-1 1:1:1", "1897-5-7 00:00:00"), tz = "UTC")
)
df$with_columns(
date = pl$col("datetime")$dt$date()
)
#> shape: (2, 2)
#> ┌─────────────────────────┬────────────┐
#> │ datetime ┆ date │
#> │ --- ┆ --- │
#> │ datetime[ms, UTC] ┆ date │
#> ╞═════════════════════════╪════════════╡
#> │ 1978-01-01 01:01:01 UTC ┆ 1978-01-01 │
#> │ 1897-05-07 00:00:00 UTC ┆ 1897-05-07 │
#> └─────────────────────────┴────────────┘