time-qq-0.0.0.2: Quasi-quoter for UTCTime times

Safe HaskellNone
LanguageHaskell2010

Data.Time.QQ

Contents

Description

This module provides quasi quoters for writing time literals.

First enable the QuasiQuotes language extension, then you will be able to write the the following:

>>> [utcIso8601| 2048-12-01  |] :: UTCTime
2048-12-01 00:00:00 UTC

Unparseable dates will throw errors at compile time.

Zoned time quoters are not provided as the time library doesn't seem to do anything with "%Z".

Synopsis

ISO8601 UTC time QuasiQuoters

utcIso8601 :: QuasiQuoter Source

ISO8601 date with seconds and optional "." with more precision following to a UTCTime.

Do not specify a timezone, the time should be UTC.

>>> [utcIso8601| 2048-12-01  |] :: UTCTime
2048-12-01 00:00:00 UTC

utcIso8601ms :: QuasiQuoter Source

ISO8601 date with seconds and optional "." with more precision following to a UTCTime.

Do not specify a timezone, the time should be UTC.

>>> [utcIso8601ms| 2099-01-01T00:00:00.42324 |]
2099-01-01 00:00:00.42324 UTC

Re-exports

data UTCTime :: *

This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.

Constructors

UTCTime 

Fields

utctDay :: Day

the day

utctDayTime :: DiffTime

the time from midnight, 0 <= t < 86401s (because of leap-seconds)

Specify your own formats

utcFormat :: String -> QuasiQuoter Source

Build a UTCTime QuasiQuoter for a given format string, as per readTime.