| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Attoparsec.Time
Documentation
timeOfDayInISO8601 :: Parser TimeOfDay Source #
>>>parseOnly timeOfDayInISO8601 "05:03:58"Right 05:03:58
>>>parseOnly timeOfDayInISO8601 "05:03:58.02"Right 05:03:58.02
>>>parseOnly timeOfDayInISO8601 "05:03:58.020"Right 05:03:58.02
Checks the elements to be within a proper range:
>>>parseOnly timeOfDayInISO8601 "24:00:00"Left "timeOfDayInISO8601 > hour: Failed reading: Validator \"hour\" failed on the following input: 24"
>>>parseOnly timeOfDayInISO8601 "00:00:60"Left "timeOfDayInISO8601 > second: Failed reading: Validator \"second\" failed on the following input: 60.000000000000"
Checks the elements to be of proper length:
>>>parseOnly timeOfDayInISO8601 "1:00:00"Left "timeOfDayInISO8601 > hour: Failed reading: Invalid decimal length"
>>>parseOnly timeOfDayInISO8601 "01:1:00"Left "timeOfDayInISO8601 > minute: Failed reading: Invalid decimal length"
dayInISO8601 :: Parser Day Source #
>>>parseOnly dayInISO8601 "2017-02-01"Right 2017-02-01
Checks the elements to be in proper range:
>>>parseOnly dayInISO8601 "2017-13-01"Left "dayInISO8601: Failed reading: Invalid combination of year month and day: (2017,13,1)"
That is accounting for leap year:
>>>parseOnly dayInISO8601 "2017-02-29"Left "dayInISO8601: Failed reading: Invalid combination of year month and day: (2017,2,29)"
>>>parseOnly dayInISO8601 "2016-02-29"Right 2016-02-29
timeZoneInISO8601 :: Parser TimeZone Source #
>>>parseOnly timeZoneInISO8601 "+01:00"Right +0100
>>>parseOnly timeZoneInISO8601 "+0100"Right +0100
>>>parseOnly timeZoneInISO8601 "-0100"Right -0100
>>>parseOnly timeZoneInISO8601 "Z"Right UTC
utcTimeInISO8601 :: Parser UTCTime Source #
>>>parseOnly utcTimeInISO8601 "2017-02-01T05:03:58+01:00"Right 2017-02-01 04:03:58 UTC