W3cubDocs

/Haskell 8

Data.Time.LocalTime

Safe Haskell Safe
Language Haskell2010

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

Fields

Instances
Instances details
Eq TimeZone
Instance details

Defined in Data.Time.LocalTime.Internal.TimeZone

Methods

(==) :: TimeZone -> TimeZone -> Bool

(/=) :: TimeZone -> TimeZone -> Bool

Data TimeZone
Instance details

Defined in Data.Time.LocalTime.Internal.TimeZone

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TimeZone -> c TimeZone Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeZone Source

toConstr :: TimeZone -> Constr Source

dataTypeOf :: TimeZone -> DataType Source

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeZone) Source

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeZone) Source

gmapT :: (forall b. Data b => b -> b) -> TimeZone -> TimeZone Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeZone -> r Source

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeZone -> r Source

gmapQ :: (forall d. Data d => d -> u) -> TimeZone -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeZone -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone Source

Ord TimeZone
Instance details

Defined in Data.Time.LocalTime.Internal.TimeZone

Read TimeZone

This only works for ±HHMM format, single-letter military time-zones, and these time-zones: "UTC", "UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT".

Instance details

Defined in Data.Time.Format.Parse

Show TimeZone

This only shows the time zone name, or offset if the name is empty.

Instance details

Defined in Data.Time.LocalTime.Internal.TimeZone

NFData TimeZone
Instance details

Defined in Data.Time.LocalTime.Internal.TimeZone

Methods

rnf :: TimeZone -> () Source

ParseTime TimeZone
Instance details

Defined in Data.Time.Format.Parse.Instances

FormatTime TimeZone
Instance details

Defined in Data.Time.Format.Format.Instances

Methods

formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> TimeZone -> String) Source

ISO8601 TimeZone

±hh:mm (ISO 8601:2004(E) sec. 4.2.5.1 extended format)

Instance details

Defined in Data.Time.Format.ISO8601

timeZoneOffsetString :: TimeZone -> String Source

Text representing the offset of this timezone, such as "-0800" or "+0400" (like %z in formatTime).

timeZoneOffsetString' :: Maybe Char -> TimeZone -> String Source

Text representing the offset of this timezone, such as "-0800" or "+0400" (like %z in formatTime), with arbitrary padding.

minutesToTimeZone :: Int -> TimeZone Source

Create a nameless non-summer timezone for this number of minutes.

hoursToTimeZone :: Int -> TimeZone Source

Create a nameless non-summer timezone for this number of hours.

utc :: TimeZone Source

The UTC time zone.

getTimeZone :: UTCTime -> IO TimeZone Source

Get the local time-zone for a given time (varying as per summertime adjustments).

getCurrentTimeZone :: IO TimeZone Source

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

Fields

  • todHour :: Int

    range 0 - 23

  • todMin :: Int

    range 0 - 59

  • todSec :: Pico

    Note that 0 <= todSec < 61, accomodating leap seconds. Any local minute may have a leap second, since leap seconds happen in all zones simultaneously

Instances
Instances details
Eq TimeOfDay
Instance details

Defined in Data.Time.LocalTime.Internal.TimeOfDay

Methods

(==) :: TimeOfDay -> TimeOfDay -> Bool

(/=) :: TimeOfDay -> TimeOfDay -> Bool

Data TimeOfDay
Instance details

Defined in Data.Time.LocalTime.Internal.TimeOfDay

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TimeOfDay -> c TimeOfDay Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeOfDay Source

toConstr :: TimeOfDay -> Constr Source

dataTypeOf :: TimeOfDay -> DataType Source

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeOfDay) Source

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeOfDay) Source

gmapT :: (forall b. Data b => b -> b) -> TimeOfDay -> TimeOfDay Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r Source

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r Source

gmapQ :: (forall d. Data d => d -> u) -> TimeOfDay -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeOfDay -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay Source

Ord TimeOfDay
Instance details

Defined in Data.Time.LocalTime.Internal.TimeOfDay

Read TimeOfDay
Instance details

Defined in Data.Time.Format.Parse

Show TimeOfDay
Instance details

Defined in Data.Time.LocalTime.Internal.TimeOfDay

NFData TimeOfDay
Instance details

Defined in Data.Time.LocalTime.Internal.TimeOfDay

Methods

rnf :: TimeOfDay -> () Source

ParseTime TimeOfDay
Instance details

Defined in Data.Time.Format.Parse.Instances

FormatTime TimeOfDay
Instance details

Defined in Data.Time.Format.Format.Instances

Methods

formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> TimeOfDay -> String) Source

ISO8601 TimeOfDay

hh:mm:ss[.sss] (ISO 8601:2004(E) sec. 4.2.2.2, 4.2.2.4(a) extended format)

Instance details

Defined in Data.Time.Format.ISO8601

midnight :: TimeOfDay Source

Hour zero

midday :: TimeOfDay Source

Hour twelve

makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay Source

timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay) Source

Convert a period of time into a count of days and a time of day since midnight. The time of day will never have a leap second.

daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime Source

Convert a count of days and a time of day since midnight into a period of time.

utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay) Source

Convert a time of day in UTC to a time of day in some timezone, together with a day adjustment.

localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay) Source

Convert a time of day in some timezone to a time of day in UTC, together with a day adjustment.

timeToTimeOfDay :: DiffTime -> TimeOfDay Source

Get the time of day given a time since midnight. Time more than 24h will be converted to leap-seconds.

timeOfDayToTime :: TimeOfDay -> DiffTime Source

Get the time since midnight for a given time of day.

dayFractionToTimeOfDay :: Rational -> TimeOfDay Source

Get the time of day given the fraction of a day since midnight.

timeOfDayToDayFraction :: TimeOfDay -> Rational Source

Get the fraction of a day since midnight given a time of day.

Calendar Duration

data CalendarDiffTime Source

Instances
Instances details
Eq CalendarDiffTime
Instance details

Defined in Data.Time.LocalTime.Internal.CalendarDiffTime

Data CalendarDiffTime

Since: time-1.9.2

Instance details

Defined in Data.Time.LocalTime.Internal.CalendarDiffTime

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CalendarDiffTime -> c CalendarDiffTime Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CalendarDiffTime Source

toConstr :: CalendarDiffTime -> Constr Source

dataTypeOf :: CalendarDiffTime -> DataType Source

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CalendarDiffTime) Source

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CalendarDiffTime) Source

gmapT :: (forall b. Data b => b -> b) -> CalendarDiffTime -> CalendarDiffTime Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CalendarDiffTime -> r Source

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CalendarDiffTime -> r Source

gmapQ :: (forall d. Data d => d -> u) -> CalendarDiffTime -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> CalendarDiffTime -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime Source

Show CalendarDiffTime
Instance details

Defined in Data.Time.LocalTime.Internal.CalendarDiffTime

Semigroup CalendarDiffTime

Additive

Instance details

Defined in Data.Time.LocalTime.Internal.CalendarDiffTime

Monoid CalendarDiffTime

Additive

Instance details

Defined in Data.Time.LocalTime.Internal.CalendarDiffTime

ParseTime CalendarDiffTime
Instance details

Defined in Data.Time.Format.Parse.Instances

FormatTime CalendarDiffTime
Instance details

Defined in Data.Time.Format.Format.Instances

Methods

formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> CalendarDiffTime -> String) Source

ISO8601 CalendarDiffTime

PyYmMdDThHmMs[.sss]S (ISO 8601:2004(E) sec. 4.4.3.2)

Instance details

Defined in Data.Time.Format.ISO8601

calendarTimeDays :: CalendarDiffDays -> CalendarDiffTime Source

calendarTimeTime :: NominalDiffTime -> CalendarDiffTime Source

scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime Source

Scale by a factor. Note that scaleCalendarDiffTime (-1) will not perfectly invert a duration, due to variable month lengths.

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
Instances
Instances details
Eq LocalTime
Instance details

Defined in Data.Time.LocalTime.Internal.LocalTime

Methods

(==) :: LocalTime -> LocalTime -> Bool

(/=) :: LocalTime -> LocalTime -> Bool

Data LocalTime
Instance details

Defined in Data.Time.LocalTime.Internal.LocalTime

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LocalTime -> c LocalTime Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LocalTime Source

toConstr :: LocalTime -> Constr Source

dataTypeOf :: LocalTime -> DataType Source

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LocalTime) Source

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LocalTime) Source

gmapT :: (forall b. Data b => b -> b) -> LocalTime -> LocalTime Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LocalTime -> r Source

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LocalTime -> r Source

gmapQ :: (forall d. Data d => d -> u) -> LocalTime -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> LocalTime -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime Source

Ord LocalTime
Instance details

Defined in Data.Time.LocalTime.Internal.LocalTime

Read LocalTime
Instance details

Defined in Data.Time.Format.Parse

Show LocalTime
Instance details

Defined in Data.Time.LocalTime.Internal.LocalTime

NFData LocalTime
Instance details

Defined in Data.Time.LocalTime.Internal.LocalTime

Methods

rnf :: LocalTime -> () Source

ParseTime LocalTime
Instance details

Defined in Data.Time.Format.Parse.Instances

FormatTime LocalTime
Instance details

Defined in Data.Time.Format.Format.Instances

Methods

formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> LocalTime -> String) Source

ISO8601 LocalTime

yyyy-mm-ddThh:mm:ss[.sss] (ISO 8601:2004(E) sec. 4.3.2 extended format)

Instance details

Defined in Data.Time.Format.ISO8601

addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime Source

addLocalTime a b = a + b

diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime Source

diffLocalTime a b = a - b

utcToLocalTime :: TimeZone -> UTCTime -> LocalTime Source

Get the local time of a UTC time in a time zone.

localTimeToUTC :: TimeZone -> LocalTime -> UTCTime Source

Get the UTC time of a local time in a time zone.

ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime Source

Get the local time of a UT1 time on a particular meridian (in degrees, positive is East).

localTimeToUT1 :: Rational -> LocalTime -> UniversalTime Source

Get the UT1 time of a local time on a particular meridian (in degrees, positive is East).

data ZonedTime Source

A local time together with a time zone.

There is no Eq instance for ZonedTime. If you want to compare local times, use zonedTimeToLocalTime. If you want to compare absolute times, use zonedTimeToUTC.

Instances
Instances details
Data ZonedTime
Instance details

Defined in Data.Time.LocalTime.Internal.ZonedTime

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ZonedTime -> c ZonedTime Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ZonedTime Source

toConstr :: ZonedTime -> Constr Source

dataTypeOf :: ZonedTime -> DataType Source

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ZonedTime) Source

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ZonedTime) Source

gmapT :: (forall b. Data b => b -> b) -> ZonedTime -> ZonedTime Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ZonedTime -> r Source

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ZonedTime -> r Source

gmapQ :: (forall d. Data d => d -> u) -> ZonedTime -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> ZonedTime -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime Source

Read ZonedTime

This only works for a zonedTimeZone in ±HHMM format, single-letter military time-zones, and these time-zones: "UTC", "UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT".

Instance details

Defined in Data.Time.Format.Parse

Show ZonedTime
Instance details

Defined in Data.Time.LocalTime.Internal.ZonedTime

NFData ZonedTime
Instance details

Defined in Data.Time.LocalTime.Internal.ZonedTime

Methods

rnf :: ZonedTime -> () Source

ParseTime ZonedTime
Instance details

Defined in Data.Time.Format.Parse.Instances

FormatTime ZonedTime
Instance details

Defined in Data.Time.Format.Format.Instances

Methods

formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> ZonedTime -> String) Source

ISO8601 ZonedTime

yyyy-mm-ddThh:mm:ss[.sss]±hh:mm (ISO 8601:2004(E) sec. 4.3.2 extended format)

Instance details

Defined in Data.Time.Format.ISO8601

utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime Source

zonedTimeToUTC :: ZonedTime -> UTCTime Source

getZonedTime :: IO ZonedTime Source

utcToLocalZonedTime :: UTCTime -> IO ZonedTime Source

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.8.3/docs/html/libraries/time-1.9.3/Data-Time-LocalTime.html