Base offset from UTC
Description
This computes the offset between a time zone and UTC. This is usually constant for all datetimes in a given time zone, but may vary in the rare case that a country switches time zone, like Samoa (Apia) did at the end of 2011. Use $dt$dst_offset() to take daylight saving time into account.
Usage
<Expr>$dt$base_utc_offset()
Value
A polars expression
Examples
library("polars")
df <- pl$DataFrame(
x = as.POSIXct(c("2011-12-29", "2012-01-01"), tz = "Pacific/Apia")
)
df$with_columns(base_utc_offset = pl$col("x")$dt$base_utc_offset())
#> shape: (2, 2)
#> ┌────────────────────────────┬─────────────────┐
#> │ x ┆ base_utc_offset │
#> │ --- ┆ --- │
#> │ datetime[ms, Pacific/Apia] ┆ duration[ms] │
#> ╞════════════════════════════╪═════════════════╡
#> │ 2011-12-29 00:00:00 -10 ┆ -11h │
#> │ 2012-01-01 00:00:00 +14 ┆ 13h │
#> └────────────────────────────┴─────────────────┘