time-1.1.2.1: time librarySource codeContentsIndex
Data.Time.LocalTime
Contents
Time zones
Time of day
Local Time
Synopsis
data TimeZone = TimeZone {
timeZoneMinutes :: Int
timeZoneSummerOnly :: Bool
timeZoneName :: String
}
timeZoneOffsetString :: TimeZone -> String
minutesToTimeZone :: Int -> TimeZone
hoursToTimeZone :: Int -> TimeZone
utc :: TimeZone
getTimeZone :: UTCTime -> IO TimeZone
getCurrentTimeZone :: IO TimeZone
data TimeOfDay = TimeOfDay {
todHour :: Int
todMin :: Int
todSec :: Pico
}
midnight :: TimeOfDay
midday :: TimeOfDay
utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
timeToTimeOfDay :: DiffTime -> TimeOfDay
timeOfDayToTime :: TimeOfDay -> DiffTime
dayFractionToTimeOfDay :: Rational -> TimeOfDay
timeOfDayToDayFraction :: TimeOfDay -> Rational
data LocalTime = LocalTime {
localDay :: Day
localTimeOfDay :: TimeOfDay
}
utcToLocalTime :: TimeZone -> UTCTime -> LocalTime
localTimeToUTC :: TimeZone -> LocalTime -> UTCTime
ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime
localTimeToUT1 :: Rational -> LocalTime -> UniversalTime
data ZonedTime = ZonedTime {
zonedTimeToLocalTime :: LocalTime
zonedTimeZone :: TimeZone
}
utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime
zonedTimeToUTC :: ZonedTime -> UTCTime
getZonedTime :: IO ZonedTime
utcToLocalZonedTime :: UTCTime -> IO ZonedTime
Time zones
data TimeZone Source
A TimeZone is a whole number of minutes offset from UTC, together with a name and a "just for summer" flag.
Constructors
TimeZone
timeZoneMinutes :: IntThe number of minutes offset from UTC. Positive means local time will be later in the day than UTC.
timeZoneSummerOnly :: BoolIs this time zone just persisting for the summer?
timeZoneName :: StringThe name of the zone, typically a three- or four-letter acronym.
show/hide Instances
timeZoneOffsetString :: TimeZone -> StringSource
Text representing the offset of this timezone, such as "-0800" or "+0400" (like %z in formatTime)
minutesToTimeZone :: Int -> TimeZoneSource
Create a nameless non-summer timezone for this number of minutes
hoursToTimeZone :: Int -> TimeZoneSource
Create a nameless non-summer timezone for this number of hours
utc :: TimeZoneSource
The UTC time zone
getTimeZone :: UTCTime -> IO TimeZoneSource
Get the local time-zone for a given time (varying as per summertime adjustments)
getCurrentTimeZone :: IO TimeZoneSource
Get the current time-zone
Time of day
data TimeOfDay Source
Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day.
Constructors
TimeOfDay
todHour :: Intrange 0 - 23
todMin :: Intrange 0 - 59
todSec :: PicoNote that 0 <= todSec < 61, accomodating leap seconds. Any local minute may have a leap second, since leap seconds happen in all zones simultaneously
show/hide Instances
midnight :: TimeOfDaySource
Hour zero
midday :: TimeOfDaySource
Hour twelve
utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)Source
Convert a ToD in UTC to a ToD in some timezone, together with a day adjustment.
localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)Source
Convert a ToD in some timezone to a ToD in UTC, together with a day adjustment.
timeToTimeOfDay :: DiffTime -> TimeOfDaySource
Get a TimeOfDay given a time since midnight. Time more than 24h will be converted to leap-seconds.
timeOfDayToTime :: TimeOfDay -> DiffTimeSource
Find out how much time since midnight a given TimeOfDay is.
dayFractionToTimeOfDay :: Rational -> TimeOfDaySource
Get a TimeOfDay given the fraction of a day since midnight.
timeOfDayToDayFraction :: TimeOfDay -> RationalSource
Get the fraction of a day since midnight given a TimeOfDay.
Local Time
data LocalTime Source
A simple day and time aggregate, where the day is of the specified parameter, and the time is a TimeOfDay. Conversion of this (as local civil time) to UTC depends on the time zone. Conversion of this (as local mean time) to UT1 depends on the longitude.
Constructors
LocalTime
localDay :: Day
localTimeOfDay :: TimeOfDay
show/hide Instances
utcToLocalTime :: TimeZone -> UTCTime -> LocalTimeSource
show a UTC time in a given time zone as a LocalTime
localTimeToUTC :: TimeZone -> LocalTime -> UTCTimeSource
find out what UTC time a given LocalTime in a given time zone is
ut1ToLocalTime :: Rational -> UniversalTime -> LocalTimeSource
1st arg is observation meridian in degrees, positive is East
localTimeToUT1 :: Rational -> LocalTime -> UniversalTimeSource
1st arg is observation meridian in degrees, positive is East
data ZonedTime Source
A local time together with a TimeZone.
Constructors
ZonedTime
zonedTimeToLocalTime :: LocalTime
zonedTimeZone :: TimeZone
show/hide Instances
utcToZonedTime :: TimeZone -> UTCTime -> ZonedTimeSource
zonedTimeToUTC :: ZonedTime -> UTCTimeSource
getZonedTime :: IO ZonedTimeSource
utcToLocalZonedTime :: UTCTime -> IO ZonedTimeSource
Produced by Haddock version 2.1.0