HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduletime-1.12.2Haskell2010

Data.Time.LocalTime

  • 5 types
  • 33 values
  • Packagetime-1.12.2
  • Exports38
  • LanguageHaskell2010
  • LicenceBSD-2-Clause
  • SourceTimeZone.hs

Time zones

38 declarations
datadata TimeZone
#

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

Constructors

Instances9Eq, Data, Ord, Read, Show, NFData, …
  • Eq TimeZoneDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeZone
  • Data TimeZoneDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeZone
  • Ord TimeZoneDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeZone
  • Read TimeZoneDefined in time-1.12.2 · Data.Time.Format.Parse · orphan

    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", per RFC 822 section 5.

  • Show TimeZoneDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeZone

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

  • NFData TimeZoneDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeZone
  • FormatTime TimeZoneDefined in time-1.12.2 · Data.Time.Format.Format.Instances · orphan
  • ParseTime TimeZoneDefined in time-1.12.2 · Data.Time.Format.Parse.Instances · orphan
  • ISO8601 TimeZoneDefined in time-1.12.2 · Data.Time.Format.ISO8601

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

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

datadata 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
    • 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

Instances9Eq, Data, Ord, Read, Show, NFData, …
  • Eq TimeOfDayDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeOfDay
  • Data TimeOfDayDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeOfDay
  • Ord TimeOfDayDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeOfDay
  • Read TimeOfDayDefined in time-1.12.2 · Data.Time.Format.Parse · orphan
  • Show TimeOfDayDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeOfDay
  • NFData TimeOfDayDefined in time-1.12.2 · Data.Time.LocalTime.Internal.TimeOfDay
  • FormatTime TimeOfDayDefined in time-1.12.2 · Data.Time.Format.Format.Instances · orphan
  • ParseTime TimeOfDayDefined in time-1.12.2 · Data.Time.Format.Parse.Instances · orphan
  • ISO8601 TimeOfDayDefined in time-1.12.2 · Data.Time.Format.ISO8601

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

datadata CalendarDiffTime
#
Instances9Eq, Data, Show, Semigroup, Monoid, NFData, …
datadata 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.

Instances9Eq, Data, Ord, Read, Show, NFData, …
  • Eq LocalTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.LocalTime
  • Data LocalTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.LocalTime
  • Ord LocalTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.LocalTime
  • Read LocalTimeDefined in time-1.12.2 · Data.Time.Format.Parse · orphan
  • Show LocalTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.LocalTime
  • NFData LocalTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.LocalTime
  • FormatTime LocalTimeDefined in time-1.12.2 · Data.Time.Format.Format.Instances · orphan
  • ParseTime LocalTimeDefined in time-1.12.2 · Data.Time.Format.Parse.Instances · orphan
  • ISO8601 LocalTimeDefined in time-1.12.2 · Data.Time.Format.ISO8601

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

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

Instances7Data, Read, Show, NFData, FormatTime, ParseTime, …
  • Data ZonedTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.ZonedTime
  • Read ZonedTimeDefined in time-1.12.2 · Data.Time.Format.Parse · orphan

    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", per RFC 822 section 5.

  • Show ZonedTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.ZonedTime

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

  • NFData ZonedTimeDefined in time-1.12.2 · Data.Time.LocalTime.Internal.ZonedTime
  • FormatTime ZonedTimeDefined in time-1.12.2 · Data.Time.Format.Format.Instances · orphan
  • ParseTime ZonedTimeDefined in time-1.12.2 · Data.Time.Format.Parse.Instances · orphan
  • ISO8601 ZonedTimeDefined in time-1.12.2 · Data.Time.Format.ISO8601

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