Safe Haskell | None |
---|
- data TimeZoneOffset
- minsToOffset :: Int -> Maybe TimeZoneOffset
- noOffset :: TimeZoneOffset
- data Hours
- intToHours :: Int -> Maybe Hours
- zeroHours :: Hours
- data Minutes
- intToMinutes :: Int -> Maybe Minutes
- zeroMinutes :: Minutes
- data Seconds
- intToSeconds :: Int -> Maybe Seconds
- zeroSeconds :: Seconds
- midnight :: (Hours, Minutes, Seconds)
- data DateTime = DateTime {}
- dateTimeMidnightUTC :: Day -> DateTime
- toUTC :: DateTime -> UTCTime
- toZonedTime :: DateTime -> ZonedTime
- fromZonedTime :: ZonedTime -> Maybe DateTime
- sameInstant :: DateTime -> DateTime -> Bool
- showDateTime :: DateTime -> String
Documentation
data TimeZoneOffset Source
The number of minutes that this timezone is offset from UTC. Can be positive, negative, or zero.
minsToOffset :: Int -> Maybe TimeZoneOffsetSource
Convert minutes to a time zone offset. I'm having a hard time deciding whether to be liberal or strict in what to accept here. Currently it is somewhat strict in that it will fail if absolute value is greater than 840 minutes; currently the article at http:en.wikipedia.orgwikiList_of_time_zones_by_UTC_offset says there is no offset greater than 14 hours, or 840 minutes.
intToHours :: Int -> Maybe HoursSource
succeeds if 0 <= x < 24
intToMinutes :: Int -> Maybe MinutesSource
succeeds if 0 <= x < 60
intToSeconds :: Int -> Maybe SecondsSource
succeeds if 0 <= x < 61 (to allow for leap seconds)
A DateTime is a a local date and time, along with a time zone
offset. The Eq and Ord instances are derived; therefore, two
DateTime instances will not be equivalent if the time zone offsets
are different, even if they are the same instant. To compare one
DateTime to another, you probably want to use toUTC
and compare
those. To see if two DateTime are the same instant, use
sameInstant
.
sameInstant :: DateTime -> DateTime -> BoolSource
Are these DateTimes the same instant in time, after adjusting for local timezones?
showDateTime :: DateTime -> StringSource
Shows a DateTime in a pretty way.