Safe Haskell | None |
---|---|
Language | Haskell2010 |
convert between UTCTime
, UTCTimeBin
, DatePart
, DatePartSmall
Synopsis
- class FromUTC a where
- fromUtc' :: (Tz' tz, Integral a) => tz -> UTCTime -> Tz (DatePart a)
- class ToUTC a where
- mkDay :: Integral a => a -> a -> a -> DatePartSmall
- mkMin :: (Num a, Integral a) => a -> a -> DatePartSmall
- mkMs :: (Num a, Integral a) => a -> a -> DatePartSmall
- normalize :: DatePartSmall -> DatePartSmall
- julian_day_offset :: Integral a => a
FromUTC
class FromUTC a where Source #
Instances
FromUTC DatePartSmall Source # | |
Defined in Data.Time.Hora.Part fromUtc :: UTCTime -> DatePartSmall Source # | |
FromUTC UTCTimeBin Source # | |
Defined in Data.Time.Hora.Part fromUtc :: UTCTime -> UTCTimeBin Source # | |
Integral a => FromUTC (DatePart a) Source # | returns DatePart a in UTC timezone |
ToUTC
DatePartSmall
:: (Num a, Integral a) | |
=> a | second |
-> a | millisecond |
-> DatePartSmall |
milliseconds including seconds
normalize :: DatePartSmall -> DatePartSmall Source #
for (Time
, DatePartSmall
) increase:
minutes if seconds > 60
days if minutes > 24 * 60
! does not change the constructor. Time
remains Time
this function is called by toUtc
before the conversion
julian_day_offset :: Integral a => a Source #
Julian day offset
https://en.wikipedia.org/wiki/Julian_day
>>>
mkDay 1 1 1 `shouldBe` (Day 1)
>>>
mkDay 1858 11 17 `shouldBe` (Day julian_day_offset)