rainbow.iso_timestamp
- iso_timestamp(value, utc_offset=None)[source]
Converts a vendor timestamp to ISO 8601, returning None if it cannot be read.
The vendors each spell wall clock their own way (
'27-Feb-18, 10:11:50','3 Feb 22 11:22 am -0500','10-May-2022 15:39:24'), and rainbow passes those strings through tometadata['date']unchanged. They are day-first and name the month, so sorting them as text does not put runs in the order they were acquired. This is the conversion the ASM export uses, and what it returns does sort as text.- Parameters:
value (str) – A timestamp in whatever spelling the vendor recorded.
utc_offset (str, optional) – UTC offset such as
'-05:00'or'Z'to stamp on a value that records none. A recorded offset is kept and never overridden.
- Returns:
The timestamp as an ISO 8601 string, or None if the spelling is one rainbow cannot read.