Data.Time.LocalTime.Compat

time-compat-1.9.8: Compatibility package for time

Safe Haskell | Trustworthy
Language | Haskell2010

Data.Time.LocalTime.Compat

Contents

- Time zones
- Time of day
- CalendarDiffTime
- Local Time
- Zoned Time

Synopsis

- data TimeZone = TimeZone {
  - timeZoneMinutes :: Int
  - timeZoneSummerOnly :: Bool
  - timeZoneName :: String
  }
- timeZoneOffsetString :: TimeZone -> String
- timeZoneOffsetString' :: Maybe Char -> 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
- makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay
- timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay)
- daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime
- utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
- localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
- timeToTimeOfDay :: DiffTime -> TimeOfDay
- timeOfDayToTime :: TimeOfDay -> DiffTime
- dayFractionToTimeOfDay :: Rational -> TimeOfDay
- timeOfDayToDayFraction :: TimeOfDay -> Rational
- pastMidnight :: DiffTime -> TimeOfDay
- sinceMidnight :: TimeOfDay -> DiffTime
- data CalendarDiffTime = CalendarDiffTime {
  - ctMonths :: Integer
  - ctTime :: NominalDiffTime
  }
- calendarTimeDays :: CalendarDiffDays -> CalendarDiffTime
- calendarTimeTime :: NominalDiffTime -> CalendarDiffTime
- scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime
- data LocalTime = LocalTime {
  - localDay :: Day
  - localTimeOfDay :: TimeOfDay
  }
- addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime
- diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime
- 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 #

A TimeZone is a whole number of minutes offset from UTC, together with a name and a "just for summer" flag.

Constructors

TimeZone |
Fields timeZoneMinutes :: Int The number of minutes offset from UTC. Positive means local time will be later in the day than UTC. timeZoneSummerOnly :: Bool Is this time zone just persisting for the summer? timeZoneName :: String The name of the zone, typically a three- or four-letter acronym.

#### Instances

Instances details

NFData TimeZone |
Instance details Defined in Data.Time.LocalTime.Internal.TimeZone Methods rnf :: TimeZone -> () #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeZone # toConstr :: TimeZone -> Constr # dataTypeOf :: TimeZone -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeZone) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeZone) # gmapT :: (forall b. Data b => b -> b) -> TimeZone -> TimeZone # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeZone -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeZone -> r # gmapQ :: (forall d. Data d => d -> u) -> TimeZone -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeZone -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeZone -> m TimeZone #
Generic TimeZone # |
Instance details Defined in Data.Time.Orphans Associated Types
type Rep TimeZone |
Instance details Defined in Data.Time.Orphans type Rep TimeZone = D1 ('MetaData "TimeZone" "Data.Time.LocalTime.Internal.TimeZone" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "TimeZone" 'PrefixI 'True) (S1 ('MetaSel ('Just "timeZoneMinutes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "timeZoneSummerOnly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "timeZoneName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))
Methods from :: TimeZone -> Rep TimeZone x # to :: Rep TimeZone x -> TimeZone #
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 Methods showsPrec :: Int -> TimeZone -> ShowS # show :: TimeZone -> String # showList :: [TimeZone] -> ShowS #
Eq TimeZone |
Instance details Defined in Data.Time.LocalTime.Internal.TimeZone Methods (==) :: TimeZone -> TimeZone -> Bool # (/=) :: TimeZone -> TimeZone -> Bool #
Ord TimeZone |
Instance details Defined in Data.Time.LocalTime.Internal.TimeZone Methods compare :: TimeZone -> TimeZone -> Ordering # (<) :: TimeZone -> TimeZone -> Bool # (<=) :: TimeZone -> TimeZone -> Bool # (>) :: TimeZone -> TimeZone -> Bool # (>=) :: TimeZone -> TimeZone -> Bool # max :: TimeZone -> TimeZone -> TimeZone # min :: TimeZone -> TimeZone -> TimeZone #
Hashable TimeZone # |
Instance details Defined in Data.Time.Orphans Methods hashWithSalt :: Int -> TimeZone -> Int # hash :: TimeZone -> Int #
ISO8601 TimeZone | `±hh:mm` (ISO 8601:2004(E) sec. 4.2.5.1 extended format)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format TimeZone #
type Rep TimeZone # |
Instance details Defined in Data.Time.Orphans type Rep TimeZone = D1 ('MetaData "TimeZone" "Data.Time.LocalTime.Internal.TimeZone" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "TimeZone" 'PrefixI 'True) (S1 ('MetaSel ('Just "timeZoneMinutes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "timeZoneSummerOnly") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "timeZoneName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))

timeZoneOffsetString :: TimeZone -> String #

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

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

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

minutesToTimeZone :: Int -> TimeZone #

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

hoursToTimeZone :: Int -> TimeZone #

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

utc :: TimeZone #

The UTC time zone.

getTimeZone :: UTCTime -> IO TimeZone #

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

On Unix systems the output of this function depends on:

1. The value of `TZ` environment variable (if set)
2. The system time zone (usually configured by `/etc/localtime` symlink)

For details see tzset(3) and localtime(3).

Example:

    > let t = UTCTime (fromGregorian 2021 7 1) 0
    > getTimeZone t
    CEST
    > setEnv "TZ" "America/New_York" >> getTimeZone t
    EDT
    > setEnv "TZ" "Europe/Berlin" >> getTimeZone t
    CEST

On Windows systems the output of this function depends on:

1. The value of `TZ` environment variable (if set). See here for how Windows interprets this variable.
2. The system time zone, configured in Settings

getCurrentTimeZone :: IO TimeZone #

Get the configured time-zone for the current time.

# Time of day

data TimeOfDay #

Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day.

`TimeOfDay 24 0 0` is considered invalid for the purposes of `makeTimeOfDayValid`, as well as reading and parsing, but valid for ISO 8601 parsing in Data.Time.Format.ISO8601.

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

NFData TimeOfDay |
Instance details Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods rnf :: TimeOfDay -> () #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeOfDay # toConstr :: TimeOfDay -> Constr # dataTypeOf :: TimeOfDay -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeOfDay) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeOfDay) # gmapT :: (forall b. Data b => b -> b) -> TimeOfDay -> TimeOfDay # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r # gmapQ :: (forall d. Data d => d -> u) -> TimeOfDay -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeOfDay -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay #
Generic TimeOfDay # |
Instance details Defined in Data.Time.Orphans Associated Types
type Rep TimeOfDay |
Instance details Defined in Data.Time.Orphans type Rep TimeOfDay = D1 ('MetaData "TimeOfDay" "Data.Time.LocalTime.Internal.TimeOfDay" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "TimeOfDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "todHour") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "todMin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "todSec") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pico))))
Methods from :: TimeOfDay -> Rep TimeOfDay x # to :: Rep TimeOfDay x -> TimeOfDay #
Show TimeOfDay |
Instance details Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods showsPrec :: Int -> TimeOfDay -> ShowS # show :: TimeOfDay -> String # showList :: [TimeOfDay] -> ShowS #
Eq TimeOfDay |
Instance details Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods (==) :: TimeOfDay -> TimeOfDay -> Bool # (/=) :: TimeOfDay -> TimeOfDay -> Bool #
Ord TimeOfDay |
Instance details Defined in Data.Time.LocalTime.Internal.TimeOfDay Methods compare :: TimeOfDay -> TimeOfDay -> Ordering # (<) :: TimeOfDay -> TimeOfDay -> Bool # (<=) :: TimeOfDay -> TimeOfDay -> Bool # (>) :: TimeOfDay -> TimeOfDay -> Bool # (>=) :: TimeOfDay -> TimeOfDay -> Bool # max :: TimeOfDay -> TimeOfDay -> TimeOfDay # min :: TimeOfDay -> TimeOfDay -> TimeOfDay #
Hashable TimeOfDay # |
Instance details Defined in Data.Time.Orphans Methods hashWithSalt :: Int -> TimeOfDay -> Int # hash :: TimeOfDay -> Int #
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 Methods iso8601Format :: Format TimeOfDay #
type Rep TimeOfDay # |
Instance details Defined in Data.Time.Orphans type Rep TimeOfDay = D1 ('MetaData "TimeOfDay" "Data.Time.LocalTime.Internal.TimeOfDay" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "TimeOfDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "todHour") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "todMin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "todSec") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pico))))

midnight :: TimeOfDay #

Hour zero

midday :: TimeOfDay #

Hour twelve

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

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

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 #

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

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

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) #

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

timeToTimeOfDay :: DiffTime -> TimeOfDay #

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

timeOfDayToTime :: TimeOfDay -> DiffTime #

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

dayFractionToTimeOfDay :: Rational -> TimeOfDay #

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

timeOfDayToDayFraction :: TimeOfDay -> Rational #

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

pastMidnight :: DiffTime -> TimeOfDay #

Same as `timeToTimeOfDay`.

sinceMidnight :: TimeOfDay -> DiffTime #

Same as `timeOfDayToTime`.

# CalendarDiffTime

data CalendarDiffTime #

Constructors

CalendarDiffTime |
Fields ctMonths :: Integer ctTime :: NominalDiffTime

#### Instances

Instances details

NFData CalendarDiffTime |
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods rnf :: CalendarDiffTime -> () #
Monoid CalendarDiffTime | Additive
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods mempty :: CalendarDiffTime # mappend :: CalendarDiffTime -> CalendarDiffTime -> CalendarDiffTime # mconcat :: [CalendarDiffTime] -> CalendarDiffTime #
Semigroup CalendarDiffTime | Additive
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods (<>) :: CalendarDiffTime -> CalendarDiffTime -> CalendarDiffTime # sconcat :: NonEmpty CalendarDiffTime -> CalendarDiffTime # stimes :: Integral b => b -> CalendarDiffTime -> 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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CalendarDiffTime # toConstr :: CalendarDiffTime -> Constr # dataTypeOf :: CalendarDiffTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CalendarDiffTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CalendarDiffTime) # gmapT :: (forall b. Data b => b -> b) -> CalendarDiffTime -> CalendarDiffTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CalendarDiffTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CalendarDiffTime -> r # gmapQ :: (forall d. Data d => d -> u) -> CalendarDiffTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CalendarDiffTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CalendarDiffTime -> m CalendarDiffTime #
Generic CalendarDiffTime # |
Instance details Defined in Data.Time.Orphans Associated Types
type Rep CalendarDiffTime |
Instance details Defined in Data.Time.Orphans type Rep CalendarDiffTime = D1 ('MetaData "CalendarDiffTime" "Data.Time.LocalTime.Internal.CalendarDiffTime" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "CalendarDiffTime" 'PrefixI 'True) (S1 ('MetaSel ('Just "ctMonths") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer) :*: S1 ('MetaSel ('Just "ctTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NominalDiffTime)))
Methods from :: CalendarDiffTime -> Rep CalendarDiffTime x # to :: Rep CalendarDiffTime x -> CalendarDiffTime #
Show CalendarDiffTime |
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods showsPrec :: Int -> CalendarDiffTime -> ShowS # show :: CalendarDiffTime -> String # showList :: [CalendarDiffTime] -> ShowS #
Eq CalendarDiffTime |
Instance details Defined in Data.Time.LocalTime.Internal.CalendarDiffTime Methods (==) :: CalendarDiffTime -> CalendarDiffTime -> Bool # (/=) :: CalendarDiffTime -> CalendarDiffTime -> Bool #
ISO8601 CalendarDiffTime | `PyYmMdDThHmMs[.sss]S` (ISO 8601:2004(E) sec. 4.4.3.2)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format CalendarDiffTime #
type Rep CalendarDiffTime # |
Instance details Defined in Data.Time.Orphans type Rep CalendarDiffTime = D1 ('MetaData "CalendarDiffTime" "Data.Time.LocalTime.Internal.CalendarDiffTime" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "CalendarDiffTime" 'PrefixI 'True) (S1 ('MetaSel ('Just "ctMonths") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer) :*: S1 ('MetaSel ('Just "ctTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NominalDiffTime)))

calendarTimeDays :: CalendarDiffDays -> CalendarDiffTime #

calendarTimeTime :: NominalDiffTime -> CalendarDiffTime #

scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime #

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

# Local Time

data LocalTime #

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 |
Fields localDay :: Day localTimeOfDay :: TimeOfDay

#### Instances

Instances details

NFData LocalTime |
Instance details Defined in Data.Time.LocalTime.Internal.LocalTime Methods rnf :: LocalTime -> () #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LocalTime # toConstr :: LocalTime -> Constr # dataTypeOf :: LocalTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LocalTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LocalTime) # gmapT :: (forall b. Data b => b -> b) -> LocalTime -> LocalTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LocalTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LocalTime -> r # gmapQ :: (forall d. Data d => d -> u) -> LocalTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LocalTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LocalTime -> m LocalTime #
Generic LocalTime # |
Instance details Defined in Data.Time.Orphans Associated Types
type Rep LocalTime |
Instance details Defined in Data.Time.Orphans type Rep LocalTime = D1 ('MetaData "LocalTime" "Data.Time.LocalTime.Internal.LocalTime" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "LocalTime" 'PrefixI 'True) (S1 ('MetaSel ('Just "localDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Day) :*: S1 ('MetaSel ('Just "localTimeOfDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TimeOfDay)))
Methods from :: LocalTime -> Rep LocalTime x # to :: Rep LocalTime x -> LocalTime #
Show LocalTime |
Instance details Defined in Data.Time.LocalTime.Internal.LocalTime Methods showsPrec :: Int -> LocalTime -> ShowS # show :: LocalTime -> String # showList :: [LocalTime] -> ShowS #
Eq LocalTime |
Instance details Defined in Data.Time.LocalTime.Internal.LocalTime Methods (==) :: LocalTime -> LocalTime -> Bool # (/=) :: LocalTime -> LocalTime -> Bool #
Ord LocalTime |
Instance details Defined in Data.Time.LocalTime.Internal.LocalTime Methods compare :: LocalTime -> LocalTime -> Ordering # (<) :: LocalTime -> LocalTime -> Bool # (<=) :: LocalTime -> LocalTime -> Bool # (>) :: LocalTime -> LocalTime -> Bool # (>=) :: LocalTime -> LocalTime -> Bool # max :: LocalTime -> LocalTime -> LocalTime # min :: LocalTime -> LocalTime -> LocalTime #
Hashable LocalTime # |
Instance details Defined in Data.Time.Orphans Methods hashWithSalt :: Int -> LocalTime -> Int # hash :: LocalTime -> Int #
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 Methods iso8601Format :: Format LocalTime #
type Rep LocalTime # |
Instance details Defined in Data.Time.Orphans type Rep LocalTime = D1 ('MetaData "LocalTime" "Data.Time.LocalTime.Internal.LocalTime" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "LocalTime" 'PrefixI 'True) (S1 ('MetaSel ('Just "localDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Day) :*: S1 ('MetaSel ('Just "localTimeOfDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TimeOfDay)))

addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime #

addLocalTime a b = a + b

diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime #

diffLocalTime a b = a - b

utcToLocalTime :: TimeZone -> UTCTime -> LocalTime #

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

localTimeToUTC :: TimeZone -> LocalTime -> UTCTime #

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

ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime #

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

localTimeToUT1 :: Rational -> LocalTime -> UniversalTime #

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

# Zoned Time

data ZonedTime #

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`.

Constructors

ZonedTime |
Fields zonedTimeToLocalTime :: LocalTime zonedTimeZone :: TimeZone

#### Instances

Instances details

NFData ZonedTime |
Instance details Defined in Data.Time.LocalTime.Internal.ZonedTime Methods rnf :: ZonedTime -> () #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ZonedTime # toConstr :: ZonedTime -> Constr # dataTypeOf :: ZonedTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ZonedTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ZonedTime) # gmapT :: (forall b. Data b => b -> b) -> ZonedTime -> ZonedTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ZonedTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ZonedTime -> r # gmapQ :: (forall d. Data d => d -> u) -> ZonedTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ZonedTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ZonedTime -> m ZonedTime #
Generic ZonedTime # |
Instance details Defined in Data.Time.Orphans Associated Types
type Rep ZonedTime |
Instance details Defined in Data.Time.Orphans type Rep ZonedTime = D1 ('MetaData "ZonedTime" "Data.Time.LocalTime.Internal.ZonedTime" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "ZonedTime" 'PrefixI 'True) (S1 ('MetaSel ('Just "zonedTimeToLocalTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalTime) :*: S1 ('MetaSel ('Just "zonedTimeZone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TimeZone)))
Methods from :: ZonedTime -> Rep ZonedTime x # to :: Rep ZonedTime x -> ZonedTime #
Show ZonedTime | For the time zone, this only shows the name, or offset if the name is empty.
Instance details Defined in Data.Time.LocalTime.Internal.ZonedTime Methods showsPrec :: Int -> ZonedTime -> ShowS # show :: ZonedTime -> String # showList :: [ZonedTime] -> ShowS #
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 Methods iso8601Format :: Format ZonedTime #
type Rep ZonedTime # |
Instance details Defined in Data.Time.Orphans type Rep ZonedTime = D1 ('MetaData "ZonedTime" "Data.Time.LocalTime.Internal.ZonedTime" "time-1.12.2-inplace" 'False) (C1 ('MetaCons "ZonedTime" 'PrefixI 'True) (S1 ('MetaSel ('Just "zonedTimeToLocalTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocalTime) :*: S1 ('MetaSel ('Just "zonedTimeZone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TimeZone)))

utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime #

zonedTimeToUTC :: ZonedTime -> UTCTime #

getZonedTime :: IO ZonedTime #

utcToLocalZonedTime :: UTCTime -> IO ZonedTime #