polars icon indicating copy to clipboard operation
polars copied to clipboard

feat(rust, python): add utc parameter to strptime

Open MarcoGorelli opened this issue 2 years ago • 0 comments

closes #6466

demo:

In [3]: ts = ['2021-03-27T23:59:59+01:00', '2021-03-28T23:59:59+02:00']

In [4]: pd.Series(pd.to_datetime(ts, utc=True))
Out[4]: 
0   2021-03-27 22:59:59+00:00
1   2021-03-28 21:59:59+00:00
dtype: datetime64[ns, UTC]

In [5]: pl.Series(ts).str.strptime(pl.Datetime, '%+', utc=True)
Out[5]: 
shape: (2,)
Series: '' [datetime[μs, UTC]]
[
        2021-03-27 22:59:59 UTC
        2021-03-28 21:59:59 UTC
]

MarcoGorelli avatar Jan 27 '23 15:01 MarcoGorelli