polars.Expr.dt.dst_offset#

Expr.dt.dst_offset() Expr[source]#

Additional offset currently in effect (typically due to daylight saving time).

Returns:
Expr

Expression of data type Duration.

See also

Expr.dt.base_utc_offset

Base offset from UTC.

Examples

>>> from datetime import datetime
>>> df = pl.DataFrame(
...     {
...         "ts": [datetime(2020, 10, 25), datetime(2020, 10, 26)],
...     }
... )
>>> df = df.with_columns(pl.col("ts").dt.replace_time_zone("Europe/London"))
>>> df.with_columns(pl.col("ts").dt.dst_offset().alias("dst_offset"))
shape: (2, 2)
┌─────────────────────────────┬──────────────┐
│ ts                          ┆ dst_offset   │
│ ---                         ┆ ---          │
│ datetime[μs, Europe/London] ┆ duration[ms] │
╞═════════════════════════════╪══════════════╡
│ 2020-10-25 00:00:00 BST     ┆ 1h           │
│ 2020-10-26 00:00:00 GMT     ┆ 0ms          │
└─────────────────────────────┴──────────────┘