How can I parse the timestamp "1920-12-24 17:23:24-06:36:36" with Haskell's time library? I tried "%Y-%m-%d %T%Q %z" but since %z
does not accept seconds, it doesn't work.
How can I parse a timestamp in this style faithfully into a ZonedTime
?
I don't think it's possible at all. The TimeZone
type is defined as:
data TimeZone
A TimeZone is a whole number of minutes offset from UTC, together with a name and a "just for summer" flag.
Constructors TimeZone timeZoneMinutes :: Int
The number of minutes offset from UTC. Positive means local time will be later in the day than UTC.
[...]
Hence, it's impossible to represent seconds in the time zone.
Chances are that there is some (unknown to me) international standard which, regulating time zones, states that there can not be any difference to UTC which is not a multiple of a full minute, hence any time zones with seconds are invalid.
Your best option seems to be to parse that string manually and remove the seconds before using the library to parse the time value.