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

  • 6 types
  • 1 class
  • 32 values
  • Packagetime-1.12.2
  • Exports54
  • LanguageHaskell2010
  • LicenceBSD-2-Clause
  • SourceDays.hs
classclass Ord p => DayPeriod p where
#

The class of types which can be represented as a period of days.

Methods

Instances4DayPeriod
newtypenewtype Day
#

The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.

Instances12Enum, Eq, Data, Ord, Read, Show, …
  • Enum DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Eq DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Data DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Ord DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Read DayDefined in time-1.12.2 · Data.Time.Format.Parse · orphan
  • Show DayDefined in time-1.12.2 · Data.Time.Calendar.Gregorian · orphan
  • Ix DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • NFData DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • DayPeriod DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • FormatTime DayDefined in time-1.12.2 · Data.Time.Format.Format.Instances · orphan
  • ParseTime DayDefined in time-1.12.2 · Data.Time.Format.Parse.Instances · orphan
  • ISO8601 DayDefined in time-1.12.2 · Data.Time.Format.ISO8601

    yyyy-mm-dd (ISO 8601:2004(E) sec. 4.1.2.2 extended format)

valueperiodFromDay :: DayPeriod p => Day -> (p, Int)
#

Get the period this day is in, with the 1-based day number within the period.

periodFromDay (periodFirstDay p) = (p,1)
datadata CalendarDiffDays
#
Instances9Eq, Data, Show, Semigroup, Monoid, NFData, …
valueisLeapYear :: Year -> Bool
#

Is this year a leap year according to the proleptic Gregorian calendar?

typetype MonthOfYear = Int
#

Month of year, in range 1 (January) to 12 (December).

typetype Year = Integer
#

Year of Common Era (when positive).

patternpattern YearMonthDay :: Year -> MonthOfYear -> DayOfMonth -> Day
#

Bidirectional abstract constructor for the proleptic Gregorian calendar. Invalid values will be clipped to the correct range, month first, then day.

Add months, with days past the last day of the month clipped to the last day. For instance, 2005-01-30 + 1 month = 2005-02-28.

Add years, matching month and day, with Feb 29th clipped to Feb 28th if necessary. For instance, 2004-02-29 + 2 years = 2006-02-28.

Add years, matching month and day, with Feb 29th rolled over to Mar 1st if necessary. For instance, 2004-02-29 + 2 years = 2006-03-01.

datadata DayOfWeek
#
Instances9Enum, Eq, Data, Ord, Read, Show, …
  • Enum DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week

    "Circular", so for example [Tuesday ..] gives an endless sequence. Also: fromEnum gives [1 .. 7] for [Monday .. Sunday], and toEnum performs mod 7 to give a cycle of days.

  • Eq DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Data DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Ord DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Read DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Show DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Ix DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • NFData DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • FormatTime DayOfWeekDefined in time-1.12.2 · Data.Time.Format.Format.Instances · orphan
valueweekAllDays :: DayOfWeek -> Day -> [Day]
#

Returns a week containing the given Day where the first day is the DayOfWeek specified.

Examples:

Example1 expression
weekAllDays Sunday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 20 .. YearMonthDay 2022 2 26]
Example1 expression
weekAllDays Monday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 21 .. YearMonthDay 2022 2 27]
Example1 expression
weekAllDays Tuesday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 15 .. YearMonthDay 2022 2 21]
valueweekFirstDay :: DayOfWeek -> Day -> Day
#

Returns the first day of a week containing the given Day.

Examples:

Example1 expression
weekFirstDay Sunday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 20
Example1 expression
weekFirstDay Monday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 21
Example1 expression
weekFirstDay Tuesday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 15
valueweekLastDay :: DayOfWeek -> Day -> Day
#

Returns the last day of a week containing the given Day.

Examples:

Example1 expression
weekLastDay Sunday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 26
Example1 expression
weekLastDay Monday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 27
Example1 expression
weekLastDay Tuesday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 21