Copyright | © 2018-2020 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Utility functions for converting time values to and from text.
Synopsis
- utcTimeToText :: TimeFormat -> UTCTime -> Text
- utcTimeFromText :: [ TimeFormat ] -> Text -> Maybe UTCTime
- data TimeFormat = TimeFormat { }
- iso8601BasicUtc :: TimeFormat
- iso8601BasicLocal :: TimeFormat
- iso8601ExtendedUtc :: TimeFormat
- iso8601ExtendedLocal :: TimeFormat
- iso8601 :: [ TimeFormat ]
- iso8601Basic :: [ TimeFormat ]
- iso8601Extended :: [ TimeFormat ]
Conversion to and from text
utcTimeToText :: TimeFormat -> UTCTime -> Text Source #
Convert the specified time value to text, using the specified time format.
utcTimeFromText :: [ TimeFormat ] -> Text -> Maybe UTCTime Source #
Attempt to use each of the specified time formats to parse the given text.
Returns a time value that corresponds to the first matching format, or
Nothing
if none of the formats matched.
Time format specification
data TimeFormat Source #
Represents a particular way of representing a moment in time in text.
Instances
Eq TimeFormat Source # | |
Defined in Data.Time.Text (==) :: TimeFormat -> TimeFormat -> Bool Source # (/=) :: TimeFormat -> TimeFormat -> Bool Source # |
Time formats
iso8601BasicUtc :: TimeFormat Source #
Represents the ISO 8601 basic format (UTC).
iso8601BasicLocal :: TimeFormat Source #
Represents the ISO 8601 basic format (with local timezone).
iso8601ExtendedUtc :: TimeFormat Source #
Represents the ISO 8601 extended format (UTC).
iso8601ExtendedLocal :: TimeFormat Source #
Represents the ISO 8601 extended format (with local timezone).
Time format families
iso8601 :: [ TimeFormat ] Source #
Represents the ISO 8601 family of formats.
iso8601Basic :: [ TimeFormat ] Source #
Represents the ISO 8601 basic family of formats.
iso8601Extended :: [ TimeFormat ] Source #
Represents the ISO 8601 extended family of formats.