herf-time-0.3.0: haskell time manipulation in a 'kerf like' style.

CopyrightPlow Technologies LLC
LicenseMIT License
MaintainerScott Murphy
Safe HaskellNone
LanguageHaskell2010

HerfTime.ZonedTime

Description

The basic idea is to use the regular local time implementation available in the time library but with a few nice wrappers.

For HerfTime to work nicely the information about what makes a time different should reside in the type.

in the case of zoned time, this is the time zone:

HerfZonedTime knows about these time zones by name:

RFC 822 sec. 5: UT, GMT, EST, EDT, CST, CDT, MST, MDT, PST, PDT.

|

Synopsis

Documentation

data HerfZonedTime (z :: Symbol) Source #

Zoned Time always has an extra parameter to convert into a fixed time

Instances
KnownSymbol z => Show (HerfZonedTime z) Source # 
Instance details

Defined in HerfTime.ZonedTime

FormatTime (HerfZonedTime z) Source # 
Instance details

Defined in HerfTime.ZonedTime

ParseTime (HerfZonedTime z) Source # 
Instance details

Defined in HerfTime.ZonedTime

KnownSymbol z => HerfedTime (HerfZonedTime z) Source #
>>> :set -XDataKinds
>>> (reherf $ ( dateTime 2016 01 01 01 01 01 :: HerfZonedTime "CST")) :: HerfZonedTime "PST"
2015-12-31T23:01:01:PST
Instance details

Defined in HerfTime.ZonedTime

KnownSymbol z => FromUTCHerfTime (HerfZonedTime z) Source # 
Instance details

Defined in HerfTime.ZonedTime

KnownSymbol z => ToUTCHerfTime (HerfZonedTime z) Source # 
Instance details

Defined in HerfTime.ZonedTime

toZonedTime :: forall z. KnownSymbol z => UTCTime -> HerfZonedTime z Source #

Helper function to convert UTCTime to HerfZoned time

fromZonedTime :: forall z. KnownSymbol z => HerfZonedTime z -> UTCTime Source #

Getting back from HerfZonedTime to UTCTime

addTimeZone :: forall z. KnownSymbol z => UTCTime -> HerfZonedTime z Source #

Add Time Zone is different than converting It takes a UTCTime and just slaps on the timezone in the ZonedTime field This is exactly what you want when you are first creating a time and almost never what you want after!

herfz :: ZonedTime -> UTCHerfTime Source #

Don't want an orphan on ZonedTime so I made herfz

reherfz :: FromUTCHerfTime b => ZonedTime -> b Source #

like reherf but for zoned time (which doesn't have a direct HerfedTime instance)

module HerfTime

module Data.Time