Extract minute from underlying Datetime representation
Description
Returns the minute number from 0 to 59.
Usage
<Expr>$dt$minute()
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(
datetime = as.POSIXct(
c(
"1978-01-01 01:01:01",
"2024-10-13 05:30:14.500",
"2065-01-01 10:20:30.06"
),
"UTC"
)
)
df$with_columns(
pl$col("datetime")$dt$minute()$alias("minute")
)
#> shape: (3, 2)
#> ┌─────────────────────────────┬────────┐
#> │ datetime ┆ minute │
#> │ --- ┆ --- │
#> │ datetime[ms, UTC] ┆ i8 │
#> ╞═════════════════════════════╪════════╡
#> │ 1978-01-01 01:01:01 UTC ┆ 1 │
#> │ 2024-10-13 05:30:14.500 UTC ┆ 30 │
#> │ 2065-01-01 10:20:30.060 UTC ┆ 20 │
#> └─────────────────────────────┴────────┘