traffic.core.time

traffic.core.time.to_datetime(time)

Facility to convert anything to a pd.Timestamp.

Return type:

Timestamp

>>> f"{to_datetime('2017-01-14')}"
'2017-01-14 00:00:00+00:00'
>>> f"{to_datetime('2017-01-14 12:00Z')}"
'2017-01-14 12:00:00+00:00'
>>> f"{to_datetime(1484395200)}"
'2017-01-14 12:00:00+00:00'
>>> f"{to_datetime(datetime(2017, 1, 14, 12, tzinfo=timezone.utc))}"
'2017-01-14 12:00:00+00:00'