-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A time library
--
-- Time, clocks and calendars
@package time
@version 1.14
-- | ISO 8601 Ordinal Date format
module Data.Time.Calendar.OrdinalDate
-- | The Modified Julian Day is a standard count of days, with zero being
-- the day 1858-11-17.
data Day
-- | Year of Common Era (when positive).
type Year = Integer
-- | Day of year, in range 1 (January 1st) to 366. December 31st is 365 in
-- a common year, 366 in a leap year.
type DayOfYear = Int
-- | Week of year, by various reckonings, generally in range 0-53 depending
-- on reckoning.
type WeekOfYear = Int
-- | Bidirectional abstract constructor for ISO 8601 Ordinal Date format.
-- Invalid day numbers will be clipped to the correct range (1 to 365 or
-- 366).
pattern YearDay :: Year -> DayOfYear -> Day
-- | Convert to ISO 8601 Ordinal Date format.
toOrdinalDate :: Day -> (Year, DayOfYear)
-- | Is this year a leap year according to the proleptic Gregorian
-- calendar?
isLeapYear :: Year -> Bool
-- | Convert from ISO 8601 Ordinal Date format. Invalid day numbers will be
-- clipped to the correct range (1 to 365 or 366).
fromOrdinalDate :: Year -> DayOfYear -> Day
-- | Convert from ISO 8601 Ordinal Date format. Invalid day numbers return
-- Nothing
fromOrdinalDateValid :: Year -> DayOfYear -> Maybe Day
-- | Show in ISO 8601 Ordinal Date format (yyyy-ddd)
showOrdinalDate :: Day -> String
-- | Get the number of the Monday-starting week in the year and the day of
-- the week. The first Monday is the first day of week 1, any earlier
-- days in the year are week 0 (as %W in formatTime).
-- Monday is 1, Sunday is 7 (as %u in formatTime).
mondayStartWeek :: Day -> (WeekOfYear, Int)
-- | Get the number of the Sunday-starting week in the year and the day of
-- the week. The first Sunday is the first day of week 1, any earlier
-- days in the year are week 0 (as %U in formatTime).
-- Sunday is 0, Saturday is 6 (as %w in formatTime).
sundayStartWeek :: Day -> (WeekOfYear, Int)
-- | The inverse of mondayStartWeek. Get a Day given the
-- year, the number of the Monday-starting week, and the day of the week.
-- The first Monday is the first day of week 1, any earlier days in the
-- year are week 0 (as %W in formatTime).
fromMondayStartWeek :: Year -> WeekOfYear -> Int -> Day
fromMondayStartWeekValid :: Year -> WeekOfYear -> Int -> Maybe Day
-- | The inverse of sundayStartWeek. Get a Day given the year
-- and the number of the day of a Sunday-starting week. The first Sunday
-- is the first day of week 1, any earlier days in the year are week 0
-- (as %U in formatTime).
fromSundayStartWeek :: Year -> WeekOfYear -> Int -> Day
fromSundayStartWeekValid :: Year -> WeekOfYear -> Int -> Maybe Day
module Data.Time.Calendar.MonthDay
-- | Month of year, in range 1 (January) to 12 (December).
type MonthOfYear = Int
pattern January :: MonthOfYear
pattern February :: MonthOfYear
pattern March :: MonthOfYear
pattern April :: MonthOfYear
pattern May :: MonthOfYear
pattern June :: MonthOfYear
pattern July :: MonthOfYear
pattern August :: MonthOfYear
pattern September :: MonthOfYear
pattern October :: MonthOfYear
pattern November :: MonthOfYear
-- | The twelve MonthOfYear patterns form a COMPLETE set.
pattern December :: MonthOfYear
-- | Day of month, in range 1 to 31.
type DayOfMonth = Int
-- | Day of year, in range 1 (January 1st) to 366. December 31st is 365 in
-- a common year, 366 in a leap year.
type DayOfYear = Int
-- | Convert month and day in the Gregorian or Julian calendars to day of
-- year. First arg is leap year flag.
monthAndDayToDayOfYear :: Bool -> MonthOfYear -> DayOfMonth -> DayOfYear
-- | Convert month and day in the Gregorian or Julian calendars to day of
-- year. First arg is leap year flag.
monthAndDayToDayOfYearValid :: Bool -> MonthOfYear -> DayOfMonth -> Maybe DayOfYear
-- | Convert day of year in the Gregorian or Julian calendars to month and
-- day. First arg is leap year flag.
dayOfYearToMonthAndDay :: Bool -> DayOfYear -> (MonthOfYear, DayOfMonth)
-- | The length of a given month in the Gregorian or Julian calendars.
-- First arg is leap year flag.
monthLength :: Bool -> MonthOfYear -> DayOfMonth
module Data.Time.Calendar.Julian
-- | Year of Common Era (when positive).
type Year = Integer
-- | Month of year, in range 1 (January) to 12 (December).
type MonthOfYear = Int
pattern January :: MonthOfYear
pattern February :: MonthOfYear
pattern March :: MonthOfYear
pattern April :: MonthOfYear
pattern May :: MonthOfYear
pattern June :: MonthOfYear
pattern July :: MonthOfYear
pattern August :: MonthOfYear
pattern September :: MonthOfYear
pattern October :: MonthOfYear
pattern November :: MonthOfYear
-- | The twelve MonthOfYear patterns form a COMPLETE set.
pattern December :: MonthOfYear
-- | Day of month, in range 1 to 31.
type DayOfMonth = Int
-- | Day of year, in range 1 (January 1st) to 366. December 31st is 365 in
-- a common year, 366 in a leap year.
type DayOfYear = Int
-- | Convert to proleptic Julian year and day format.
toJulianYearAndDay :: Day -> (Year, DayOfYear)
-- | Convert from proleptic Julian year and day format. Invalid day numbers
-- will be clipped to the correct range (1 to 365 or 366).
fromJulianYearAndDay :: Year -> DayOfYear -> Day
-- | Is this year a leap year according to the proleptic Julian calendar?
isJulianLeapYear :: Year -> Bool
-- | Convert from proleptic Julian year and day format. Invalid day numbers
-- will return Nothing
fromJulianYearAndDayValid :: Year -> DayOfYear -> Maybe Day
-- | Show in proleptic Julian year and day format (yyyy-ddd)
showJulianYearAndDay :: Day -> String
-- | Convert to proleptic Julian calendar.
toJulian :: Day -> (Year, MonthOfYear, DayOfMonth)
-- | Convert from proleptic Julian calendar. Invalid values will be clipped
-- to the correct range, month first, then day.
fromJulian :: Year -> MonthOfYear -> DayOfMonth -> Day
-- | Bidirectional abstract constructor for the proleptic Julian calendar.
-- Invalid values will be clipped to the correct range, month first, then
-- day.
pattern JulianYearMonthDay :: Year -> MonthOfYear -> DayOfMonth -> Day
-- | Convert from proleptic Julian calendar. Invalid values will return
-- Nothing.
fromJulianValid :: Year -> MonthOfYear -> DayOfMonth -> Maybe Day
-- | Show in ISO 8601 format (yyyy-mm-dd)
showJulian :: Day -> String
-- | The number of days in a given month according to the proleptic Julian
-- calendar.
julianMonthLength :: Year -> MonthOfYear -> DayOfMonth
-- | 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.
addJulianMonthsClip :: Integer -> Day -> Day
-- | Add months, with days past the last day of the month rolling over to
-- the next month. For instance, 2005-01-30 + 1 month = 2005-03-02.
addJulianMonthsRollOver :: Integer -> Day -> Day
-- | 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.
addJulianYearsClip :: Integer -> Day -> Day
-- | 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.
addJulianYearsRollOver :: Integer -> Day -> Day
-- | Add months (clipped to last day), then add days
addJulianDurationClip :: CalendarDiffDays -> Day -> Day
-- | Add months (rolling over to next month), then add days
addJulianDurationRollOver :: CalendarDiffDays -> Day -> Day
-- | Calendrical difference, with as many whole months as possible
diffJulianDurationClip :: Day -> Day -> CalendarDiffDays
-- | Calendrical difference, with as many whole months as possible.
diffJulianDurationRollOver :: Day -> Day -> CalendarDiffDays
-- | An absolute count of common calendar months.
module Data.Time.Calendar.Month
-- | An absolute count of common calendar months. Number is equal to
-- (year * 12) + (monthOfYear - 1).
newtype Month
MkMonth :: Integer -> Month
addMonths :: Integer -> Month -> Month
diffMonths :: Month -> Month -> Integer
-- | Bidirectional abstract constructor. Invalid months of year will be
-- clipped to the correct range.
pattern YearMonth :: Year -> MonthOfYear -> Month
fromYearMonthValid :: Year -> MonthOfYear -> Maybe Month
-- | Bidirectional abstract constructor. Invalid days of month will be
-- clipped to the correct range.
pattern MonthDay :: Month -> DayOfMonth -> Day
fromMonthDayValid :: Month -> DayOfMonth -> Maybe Day
instance GHC.Generics.Generic Data.Time.Calendar.Month.Month
instance Language.Haskell.TH.Syntax.Lift Data.Time.Calendar.Month.Month
instance Data.Data.Data Data.Time.Calendar.Month.Month
instance GHC.Classes.Ord Data.Time.Calendar.Month.Month
instance GHC.Classes.Eq Data.Time.Calendar.Month.Month
instance Control.DeepSeq.NFData Data.Time.Calendar.Month.Month
instance GHC.Enum.Enum Data.Time.Calendar.Month.Month
instance GHC.Ix.Ix Data.Time.Calendar.Month.Month
instance GHC.Show.Show Data.Time.Calendar.Month.Month
instance GHC.Read.Read Data.Time.Calendar.Month.Month
instance Data.Time.Calendar.Days.DayPeriod Data.Time.Calendar.Month.Month
-- | Year quarters.
module Data.Time.Calendar.Quarter
-- | Quarters of each year. Each quarter corresponds to three months.
data QuarterOfYear
Q1 :: QuarterOfYear
Q2 :: QuarterOfYear
Q3 :: QuarterOfYear
Q4 :: QuarterOfYear
addQuarters :: Integer -> Quarter -> Quarter
diffQuarters :: Quarter -> Quarter -> Integer
-- | An absolute count of year quarters. Number is equal to (year * 4)
-- + (quarterOfYear - 1).
newtype Quarter
MkQuarter :: Integer -> Quarter
-- | Bidirectional abstract constructor.
pattern YearQuarter :: Year -> QuarterOfYear -> Quarter
-- | The QuarterOfYear this MonthOfYear is in.
monthOfYearQuarter :: MonthOfYear -> QuarterOfYear
-- | The Quarter this Month is in.
monthQuarter :: Month -> Quarter
-- | The Quarter this Day is in.
dayQuarter :: Day -> Quarter
-- | Day of quarter, in range 1 to 92.
type DayOfQuarter = Int
-- | Bidirectional abstract constructor. Invalid days of quarter will be
-- clipped to the correct range.
pattern QuarterDay :: Quarter -> DayOfQuarter -> Day
instance GHC.Generics.Generic Data.Time.Calendar.Quarter.QuarterOfYear
instance Language.Haskell.TH.Syntax.Lift Data.Time.Calendar.Quarter.QuarterOfYear
instance GHC.Ix.Ix Data.Time.Calendar.Quarter.QuarterOfYear
instance GHC.Show.Show Data.Time.Calendar.Quarter.QuarterOfYear
instance GHC.Read.Read Data.Time.Calendar.Quarter.QuarterOfYear
instance Data.Data.Data Data.Time.Calendar.Quarter.QuarterOfYear
instance GHC.Classes.Ord Data.Time.Calendar.Quarter.QuarterOfYear
instance GHC.Classes.Eq Data.Time.Calendar.Quarter.QuarterOfYear
instance GHC.Generics.Generic Data.Time.Calendar.Quarter.Quarter
instance Data.Data.Data Data.Time.Calendar.Quarter.Quarter
instance GHC.Classes.Ord Data.Time.Calendar.Quarter.Quarter
instance GHC.Classes.Eq Data.Time.Calendar.Quarter.Quarter
instance Control.DeepSeq.NFData Data.Time.Calendar.Quarter.Quarter
instance GHC.Enum.Enum Data.Time.Calendar.Quarter.Quarter
instance GHC.Ix.Ix Data.Time.Calendar.Quarter.Quarter
instance GHC.Show.Show Data.Time.Calendar.Quarter.Quarter
instance GHC.Read.Read Data.Time.Calendar.Quarter.Quarter
instance Data.Time.Calendar.Days.DayPeriod Data.Time.Calendar.Quarter.Quarter
instance GHC.Enum.Enum Data.Time.Calendar.Quarter.QuarterOfYear
instance GHC.Enum.Bounded Data.Time.Calendar.Quarter.QuarterOfYear
instance Control.DeepSeq.NFData Data.Time.Calendar.Quarter.QuarterOfYear
-- | Week-based calendars
module Data.Time.Calendar.WeekDate
-- | Year of Common Era (when positive).
type Year = Integer
-- | Week of year, by various reckonings, generally in range 0-53 depending
-- on reckoning.
type WeekOfYear = Int
data DayOfWeek
Monday :: DayOfWeek
Tuesday :: DayOfWeek
Wednesday :: DayOfWeek
Thursday :: DayOfWeek
Friday :: DayOfWeek
Saturday :: DayOfWeek
Sunday :: DayOfWeek
dayOfWeek :: Day -> DayOfWeek
data FirstWeekType
-- | first week is the first whole week of the year
FirstWholeWeek :: FirstWeekType
-- | first week is the first week with four days in the year
FirstMostWeek :: FirstWeekType
-- | Convert to the given kind of "week calendar". Note that the year
-- number matches the weeks, and so is not always the same as the
-- Gregorian year number.
toWeekCalendar :: FirstWeekType -> DayOfWeek -> Day -> (Year, WeekOfYear, DayOfWeek)
-- | Convert from the given kind of "week calendar". Invalid week and day
-- values will be clipped to the correct range.
fromWeekCalendar :: FirstWeekType -> DayOfWeek -> Year -> WeekOfYear -> DayOfWeek -> Day
-- | Convert from the given kind of "week calendar". Invalid week and day
-- values will return Nothing.
fromWeekCalendarValid :: FirstWeekType -> DayOfWeek -> Year -> WeekOfYear -> DayOfWeek -> Maybe Day
-- | Convert to ISO 8601 Week Date format. First element of result is year,
-- second week number (1-53), third day of week (1 for Monday to 7 for
-- Sunday). Note that "Week" years are not quite the same as Gregorian
-- years, as the first day of the year is always a Monday. The first week
-- of a year is the first week to contain at least four days in the
-- corresponding Gregorian year.
toWeekDate :: Day -> (Year, WeekOfYear, Int)
-- | Convert from ISO 8601 Week Date format. First argument is year, second
-- week number (1-52 or 53), third day of week (1 for Monday to 7 for
-- Sunday). Invalid week and day values will be clipped to the correct
-- range.
fromWeekDate :: Year -> WeekOfYear -> Int -> Day
-- | Bidirectional abstract constructor for ISO 8601 Week Date format.
-- Invalid week values will be clipped to the correct range.
pattern YearWeekDay :: Year -> WeekOfYear -> DayOfWeek -> Day
-- | Convert from ISO 8601 Week Date format. First argument is year, second
-- week number (1-52 or 53), third day of week (1 for Monday to 7 for
-- Sunday). Invalid week and day values will return Nothing.
fromWeekDateValid :: Year -> WeekOfYear -> Int -> Maybe Day
-- | Show in ISO 8601 Week Date format as yyyy-Www-d (e.g. "2006-W46-3").
showWeekDate :: Day -> String
instance Language.Haskell.TH.Syntax.Lift Data.Time.Calendar.WeekDate.FirstWeekType
instance GHC.Classes.Eq Data.Time.Calendar.WeekDate.FirstWeekType
-- | Fast access to the system clock.
module Data.Time.Clock.System
-- | The day of the epoch of SystemTime, 1970-01-01
systemEpochDay :: Day
-- | SystemTime is time returned by system clock functions. Its
-- semantics depends on the clock function, but the epoch is typically
-- the beginning of 1970. Note that systemNanoseconds of 1E9 to
-- 2E9-1 can be used to represent leap seconds.
data SystemTime
MkSystemTime :: {-# UNPACK #-} !Int64 -> {-# UNPACK #-} !Word32 -> SystemTime
[systemSeconds] :: SystemTime -> {-# UNPACK #-} !Int64
[systemNanoseconds] :: SystemTime -> {-# UNPACK #-} !Word32
-- | Map leap-second values to the start of the following second. The
-- resulting systemNanoseconds will always be in the range 0 to
-- 1E9-1.
truncateSystemTimeLeapSecond :: SystemTime -> SystemTime
-- | Get the system time, epoch start of 1970 UTC, leap-seconds ignored.
-- getSystemTime is typically much faster than
-- getCurrentTime.
getSystemTime :: IO SystemTime
-- | Convert SystemTime to UTCTime, matching zero
-- SystemTime to midnight of systemEpochDay UTC.
systemToUTCTime :: SystemTime -> UTCTime
-- | Convert UTCTime to SystemTime, matching zero
-- SystemTime to midnight of systemEpochDay UTC.
utcToSystemTime :: UTCTime -> SystemTime
-- | Convert SystemTime to AbsoluteTime, matching zero
-- SystemTime to midnight of systemEpochDay TAI.
systemToTAITime :: SystemTime -> AbsoluteTime
-- | POSIX time, if you need to deal with timestamps and the like. Most
-- people won't need this module.
--
-- You can use POSIXTime to obtain integer/word timestamps. For
-- example:
--
--
-- import Data.Time
-- import Data.Time.Clock.POSIX
-- import Data.Int
--
-- nanosSinceEpoch :: UTCTime -> Int64
-- nanosSinceEpoch =
-- floor . (1e9 *) . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds
--
-- main :: IO ()
-- main = do
-- u <- getCurrentTime
-- print $ nanosSinceEpoch u
--
module Data.Time.Clock.POSIX
-- | 86400 nominal seconds in every day
posixDayLength :: NominalDiffTime
-- | POSIX time is the nominal time since 1970-01-01 00:00 UTC
--
-- To convert from a CTime or System.Posix.EpochTime, use
-- realToFrac.
type POSIXTime = NominalDiffTime
posixSecondsToUTCTime :: POSIXTime -> UTCTime
utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime
-- | Get the current POSIX time from the system clock.
getPOSIXTime :: IO POSIXTime
-- | Get the current UTCTime from the system clock.
getCurrentTime :: IO UTCTime
systemToPOSIXTime :: SystemTime -> POSIXTime
-- | The contents of this module is liable to change, or disappear
-- entirely. Please let me know if you depend on anything here.
module Data.Time.Format.Internal
-- | A text format for a type
data Format t
MkFormat :: (t -> Maybe String) -> ReadP t -> Format t
-- | Show a value in the format, if representable
[formatShowM] :: Format t -> t -> Maybe String
-- | Read a value in the format
[formatReadP] :: Format t -> ReadP t
-- | Substitute various time-related information for each %-code in the
-- string, as per formatCharacter.
--
-- The general form is
-- %<modifier><width><alternate><specifier>,
-- where <modifier>, <width>, and
-- <alternate> are optional.
--
-- <modifier>
--
-- glibc-style modifiers can be used before the specifier (here marked as
-- z):
--
--
-- - %-z no padding
-- - %_z pad with spaces
-- - %0z pad with zeros
-- - %^z convert to upper case
-- - %#z convert to lower case (consistently, unlike
-- glibc)
--
--
-- <width>
--
-- Width digits can also be used after any modifiers and before the
-- specifier (here marked as z), for example:
--
--
-- - %4z pad to 4 characters (with default padding
-- character)
-- - %_12z pad with spaces to 12 characters
--
--
-- <alternate>
--
-- An optional E character indicates an alternate formatting.
-- Currently this only affects %Z and %z.
--
--
-- - %Ez alternate formatting
--
--
-- <specifier>
--
-- For all types (note these three are done by formatTime, not by
-- formatCharacter):
--
--
-- - %% %
-- - %t tab
-- - %n newline
--
--
-- TimeZone
--
-- For TimeZone (and ZonedTime and UTCTime):
--
--
-- - %z timezone offset in the format
-- ±HHMM
-- - %Ez timezone offset in the format
-- ±HH:MM
-- - %Z timezone name (or else offset in the format
-- ±HHMM)
-- - %EZ timezone name (or else offset in the format
-- ±HH:MM)
--
--
-- LocalTime
--
-- For LocalTime (and ZonedTime and UTCTime
-- and UniversalTime):
--
--
-- - %c as dateTimeFmt locale (e.g.
-- %a %b %e %H:%M:%S %Z %Y)
--
--
-- TimeOfDay
--
-- For TimeOfDay (and LocalTime and ZonedTime
-- and UTCTime and UniversalTime):
--
--
-- - %R same as %H:%M
-- - %T same as %H:%M:%S
-- - %X as timeFmt locale (e.g.
-- %H:%M:%S)
-- - %r as time12Fmt locale (e.g.
-- %I:%M:%S %p)
-- - %P day-half of day from (amPm
-- locale), converted to lowercase, am,
-- pm
-- - %p day-half of day from (amPm
-- locale), AM, PM
-- - %H hour of day (24-hour), 0-padded to two chars,
-- 00 - 23
-- - %k hour of day (24-hour), space-padded to two
-- chars, 0 - 23
-- - %I hour of day-half (12-hour), 0-padded to two
-- chars, 01 - 12
-- - %l hour of day-half (12-hour), space-padded to two
-- chars, 1 - 12
-- - %M minute of hour, 0-padded to two chars,
-- 00 - 59
-- - %S second of minute (without decimal part),
-- 0-padded to two chars, 00 - 60
-- - %q picosecond of second, 0-padded to twelve chars,
-- 000000000000 - 999999999999.
-- - %Q decimal point and fraction of second, up to 12
-- second decimals, without trailing zeros. For a whole number of
-- seconds, %Q omits the decimal point unless padding is
-- specified.
--
--
-- UTCTime and ZonedTime
--
-- For UTCTime and ZonedTime:
--
--
-- - %s number of whole seconds since the Unix epoch.
-- For times before the Unix epoch, this is a negative number. Note that
-- in %s.%q and %s%Q the decimals are positive, not
-- negative. For example, 0.9 seconds before the Unix epoch is formatted
-- as -1.1 with %s%Q.
--
--
-- DayOfWeek
--
-- For DayOfWeek (and Day and LocalTime and
-- ZonedTime and UTCTime and UniversalTime):
--
--
-- - %u day of week number for Week Date format,
-- 1 (= Monday) - 7 (= Sunday)
-- - %w day of week number, 0 (= Sunday) -
-- 6 (= Saturday)
-- - %a day of week, short form (snd from
-- wDays locale), Sun - Sat
-- - %A day of week, long form (fst from
-- wDays locale), Sunday -
-- Saturday
--
--
-- Month
--
-- For Month (and Day and LocalTime and
-- ZonedTime and UTCTime and UniversalTime):
--
--
-- - %Y year, no padding. Note %0Y and
-- %_Y pad to four chars
-- - %y year of century, 0-padded to two chars,
-- 00 - 99
-- - %C century, no padding. Note %0C and
-- %_C pad to two chars
-- - %B month name, long form (fst from
-- months locale), January -
-- December
-- - %b, %h month name, short form (snd
-- from months locale), Jan - Dec
-- - %m month of year, 0-padded to two chars,
-- 01 - 12
--
--
-- Day
--
-- For Day (and LocalTime and ZonedTime and
-- UTCTime and UniversalTime):
--
--
-- - %D same as %m/%d/%y
-- - %F same as %Y-%m-%d
-- - %x as dateFmt locale (e.g.
-- %m/%d/%y)
-- - %d day of month, 0-padded to two chars,
-- 01 - 31
-- - %e day of month, space-padded to two chars,
-- 1 - 31
-- - %j day of year, 0-padded to three chars,
-- 001 - 366
-- - %f century for Week Date format, no padding. Note
-- %0f and %_f pad to two chars
-- - %V week of year for Week Date format, 0-padded to
-- two chars, 01 - 53
-- - %U week of year where weeks start on Sunday (as
-- sundayStartWeek), 0-padded to two chars, 00 -
-- 53
-- - %W week of year where weeks start on Monday (as
-- mondayStartWeek), 0-padded to two chars, 00 -
-- 53
--
--
-- Duration types
--
-- The specifiers for DiffTime, NominalDiffTime,
-- CalendarDiffDays, and CalendarDiffTime are
-- semantically separate from the other types. Specifiers on negative
-- time differences will generally be negative (think rem rather
-- than mod).
--
-- NominalDiffTime and DiffTime
--
-- Note that a "minute" of DiffTime is simply 60 SI seconds,
-- rather than a minute of civil time. Use NominalDiffTime to
-- work with civil time, ignoring any leap seconds.
--
-- For NominalDiffTime and DiffTime:
--
--
-- - %w total whole weeks
-- - %d total whole days
-- - %D whole days of week
-- - %h total whole hours
-- - %H whole hours of day
-- - %m total whole minutes
-- - %M whole minutes of hour
-- - %s total whole seconds
-- - %Es total seconds, with decimal point and up to
-- <width> (default 12) decimal places, without trailing zeros. For
-- a whole number of seconds, %Es omits the decimal point unless
-- padding is specified.
-- - %0Es total seconds, with decimal point and
-- <width> (default 12) decimal places.
-- - %S whole seconds of minute
-- - %ES seconds of minute, with decimal point and up
-- to <width> (default 12) decimal places, without trailing zeros.
-- For a whole number of seconds, %ES omits the decimal point
-- unless padding is specified.
-- - %0ES seconds of minute as two digits, with decimal
-- point and <width> (default 12) decimal places.
--
--
-- CalendarDiffDays
--
-- For CalendarDiffDays (and CalendarDiffTime):
--
--
-- - %y total years
-- - %b total months
-- - %B months of year
-- - %w total weeks, not including months
-- - %d total days, not including months
-- - %D days of week
--
--
-- CalendarDiffTime
--
-- For CalendarDiffTime:
--
--
-- - %h total hours, not including months
-- - %H hours of day
-- - %m total minutes, not including months
-- - %M minutes of hour
-- - %s total whole seconds, not including months
-- - %Es total seconds, not including months, with
-- decimal point and up to <width> (default 12) decimal places,
-- without trailing zeros. For a whole number of seconds, %Es
-- omits the decimal point unless padding is specified.
-- - %0Es total seconds, not including months, with
-- decimal point and <width> (default 12) decimal places.
-- - %S whole seconds of minute
-- - %ES seconds of minute, with decimal point and up
-- to <width> (default 12) decimal places, without trailing zeros.
-- For a whole number of seconds, %ES omits the decimal point
-- unless padding is specified.
-- - %0ES seconds of minute as two digits, with decimal
-- point and <width> (default 12) decimal places.
--
formatTime :: FormatTime t => TimeLocale -> String -> t -> String
type FormatNumericPadding = Maybe Char
data FormatOptions
MkFormatOptions :: TimeLocale -> Maybe FormatNumericPadding -> Maybe Int -> FormatOptions
[foLocale] :: FormatOptions -> TimeLocale
[foPadding] :: FormatOptions -> Maybe FormatNumericPadding
[foWidth] :: FormatOptions -> Maybe Int
class FormatTime t
formatCharacter :: FormatTime t => Bool -> Char -> Maybe (FormatOptions -> t -> String)
class (Num t, Ord t, Show t) => ShowPadded t
data PadOption
formatGeneral :: Bool -> Bool -> Int -> Char -> (TimeLocale -> PadOption -> t -> String) -> FormatOptions -> t -> String
formatString :: (TimeLocale -> t -> String) -> FormatOptions -> t -> String
formatNumber :: ShowPadded i => Bool -> Int -> Char -> (t -> i) -> FormatOptions -> t -> String
formatNumberStd :: Int -> (t -> Integer) -> FormatOptions -> t -> String
showPaddedFixed :: HasResolution a => PadOption -> PadOption -> Fixed a -> String
showPaddedFixedFraction :: HasResolution a => PadOption -> Fixed a -> String
quotBy :: (Real a, Integral b) => a -> a -> b
remBy :: Real a => a -> a -> a
data ParseNumericPadding
NoPadding :: ParseNumericPadding
SpacePadding :: ParseNumericPadding
ZeroPadding :: ParseNumericPadding
-- | The class of types which can be parsed given a UNIX-style time format
-- string.
class ParseTime t
substituteTimeSpecifier :: ParseTime t => Proxy t -> TimeLocale -> Char -> Maybe String
-- | Get the string corresponding to the given format specifier.
parseTimeSpecifier :: ParseTime t => Proxy t -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String
-- | Builds a time value from a parsed input string. If the input does not
-- include all the information needed to construct a complete value, any
-- missing parts should be taken from 1970-01-01 00:00:00 +0000 (which
-- was a Thursday). In the absence of %C or %Y, century
-- is 1969 - 2068.
buildTime :: ParseTime t => TimeLocale -> [(Char, String)] -> Maybe t
parseSpecifiers :: ParseTime t => Proxy t -> TimeLocale -> String -> ReadP [(Char, String)]
timeSubstituteTimeSpecifier :: TimeLocale -> Char -> Maybe String
timeParseTimeSpecifier :: TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String
durationParseTimeSpecifier :: TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String
module Data.Time.Format.ISO8601
-- | A text format for a type
data Format t
-- | Show a value in the format, if representable
formatShowM :: Format t -> t -> Maybe String
-- | Show a value in the format, or error if unrepresentable
formatShow :: Format t -> t -> String
-- | Read a value in the format
formatReadP :: Format t -> ReadP t
-- | Parse a value in the format
formatParseM :: MonadFail m => Format t -> String -> m t
class ISO8601 t
-- | The most commonly used ISO 8601 format for this type.
iso8601Format :: ISO8601 t => Format t
-- | Show in the most commonly used ISO 8601 format.
iso8601Show :: ISO8601 t => t -> String
-- | Parse the most commonly used ISO 8601 format.
iso8601ParseM :: (MonadFail m, ISO8601 t) => String -> m t
data FormatExtension
-- | Use hyphens and colons. [ISO 8601:2004(E) sec. 2.3.4]
ExtendedFormat :: FormatExtension
-- | Omit hyphens and colons. "The basic format should be avoided in plain
-- text." [ISO 8601:2004(E) sec. 2.3.3]
BasicFormat :: FormatExtension
-- | Read a value in either extended or basic format
formatReadPExtension :: (FormatExtension -> Format t) -> ReadP t
-- | Parse a value in either extended or basic format
parseFormatExtension :: MonadFail m => (FormatExtension -> Format t) -> String -> m t
-- | yyyy-mm-dd (extended), yyyymmdd (basic) [ISO
-- 8601:2004(E) sec. 4.1.2.2]
calendarFormat :: FormatExtension -> Format Day
-- | yyyy-mm [ISO 8601:2004(E) sec. 4.1.2.3(a)]
yearMonthFormat :: Format (Integer, Int)
-- | yyyy [ISO 8601:2004(E) sec. 4.1.2.3(b)]
yearFormat :: Format Integer
-- | yy [ISO 8601:2004(E) sec. 4.1.2.3(c)]
centuryFormat :: Format Integer
-- | ±yyyyy-mm-dd (extended), ±yyyyymmdd
-- (basic) [ISO 8601:2004(E) sec. 4.1.2.4(a)]
expandedCalendarFormat :: Int -> FormatExtension -> Format Day
-- | ±yyyyy-mm [ISO 8601:2004(E) sec. 4.1.2.4(b)]
expandedYearMonthFormat :: Int -> Format (Integer, Int)
-- | ±yyyyy [ISO 8601:2004(E) sec. 4.1.2.4(c)]
expandedYearFormat :: Int -> Format Integer
-- | ±yyy [ISO 8601:2004(E) sec. 4.1.2.4(d)]
expandedCenturyFormat :: Int -> Format Integer
-- | yyyy-ddd (extended), yyyyddd (basic) [ISO
-- 8601:2004(E) sec. 4.1.3.2]
ordinalDateFormat :: FormatExtension -> Format Day
-- | yyyyy-ddd (extended), yyyyyddd (basic)
-- [ISO 8601:2004(E) sec. 4.1.3.3]
expandedOrdinalDateFormat :: Int -> FormatExtension -> Format Day
-- | yyyy-Www-D (extended), yyyyWwwd (basic) [ISO
-- 8601:2004(E) sec. 4.1.4.2]
weekDateFormat :: FormatExtension -> Format Day
-- | yyyy-Www (extended), yyyyWww (basic) [ISO
-- 8601:2004(E) sec. 4.1.4.3]
yearWeekFormat :: FormatExtension -> Format (Integer, Int)
-- | ±yyyyy-Www-d (extended), ±yyyyyWwwD
-- (basic) [ISO 8601:2004(E) sec. 4.1.4.4]
expandedWeekDateFormat :: Int -> FormatExtension -> Format Day
-- | ±yyyyy-Www (extended), ±yyyyyWww
-- (basic) [ISO 8601:2004(E) sec. 4.1.4.4]
expandedYearWeekFormat :: Int -> FormatExtension -> Format (Integer, Int)
-- | hh:mm:ss[.ss] (extended), hhmmss[.ss]
-- (basic) [ISO 8601:2004(E) sec. 4.2.2.2, 4.2.2.4(a)]
timeOfDayFormat :: FormatExtension -> Format TimeOfDay
-- | hh:mm[.mm] (extended), hhmm[.mm]
-- (basic) [ISO 8601:2004(E) sec. 4.2.2.3(a), 4.2.2.4(b)]
hourMinuteFormat :: FormatExtension -> Format TimeOfDay
-- | hh[.hh] [ISO 8601:2004(E) sec. 4.2.2.3(b), 4.2.2.4(c)]
hourFormat :: Format TimeOfDay
-- | Tx [ISO 8601:2004(E) sec. 4.2.2.5]
withTimeDesignator :: Format t -> Format t
-- | xZ [ISO 8601:2004(E) sec. 4.2.4]
withUTCDesignator :: Format t -> Format t
-- | ±hh:mm (extended), ±hhmm (basic) [ISO 8601:2004(E)
-- sec. 4.2.5.1]
timeOffsetFormat :: FormatExtension -> Format TimeZone
-- | hh:mm:ss±hh:mm (extended), hhmmss±hhmm (basic) [ISO
-- 8601:2004(E) sec. 4.2.5.2]
timeOfDayAndOffsetFormat :: FormatExtension -> Format (TimeOfDay, TimeZone)
-- | xTy [ISO 8601:2004(E) sec. 4.3.2]
localTimeFormat :: Format Day -> Format TimeOfDay -> Format LocalTime
-- | xTy±hh:mm (extended), xTy±hhmm (basic) [ISO
-- 8601:2004(E) sec. 4.3.2]
zonedTimeFormat :: Format Day -> Format TimeOfDay -> FormatExtension -> Format ZonedTime
-- | xTyZ [ISO 8601:2004(E) sec. 4.3.2]
utcTimeFormat :: Format Day -> Format TimeOfDay -> Format UTCTime
-- | xTy [ISO 8601:2004(E) sec. 4.3.3]
dayAndTimeFormat :: Format Day -> Format time -> Format (Day, time)
-- | x±hh:mm (extended), x±hhmm (basic) [ISO 8601:2004(E)
-- sec. 4.3.3]
timeAndOffsetFormat :: Format t -> FormatExtension -> Format (t, TimeZone)
-- | PyyYmmMddD [ISO 8601:2004(E) sec. 4.4.3.2]
durationDaysFormat :: Format CalendarDiffDays
-- | PyyYmmMddDThhHmmMss[.ss]S [ISO 8601:2004(E) sec.
-- 4.4.3.2]
durationTimeFormat :: Format CalendarDiffTime
-- | Pyyyy-mm-dd (extended), Pyyyymmdd (basic) [ISO
-- 8601:2004(E) sec. 4.4.3.3]
alternativeDurationDaysFormat :: FormatExtension -> Format CalendarDiffDays
-- | Pyyyy-mm-ddThh:mm:ss (extended), PyyyymmddThhmmss
-- (basic) [ISO 8601:2004(E) sec. 4.4.3.3]
alternativeDurationTimeFormat :: FormatExtension -> Format CalendarDiffTime
-- | x/y [ISO 8601:2004(E) sec. 4.4.4.1]
intervalFormat :: Format a -> Format b -> Format (a, b)
-- | Rn/x/y [ISO 8601:2004(E) sec. 4.5]
recurringIntervalFormat :: Format a -> Format b -> Format (Int, a, b)
-- | Like makeTimeOfDayValid, but accepts 24 0 0 per ISO
-- 8601:2004(E) sec. 4.2.3
isoMakeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay
instance Data.Time.Format.ISO8601.ISO8601 Data.Time.Calendar.Days.Day
instance Data.Time.Format.ISO8601.ISO8601 Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
instance Data.Time.Format.ISO8601.ISO8601 Data.Time.LocalTime.Internal.TimeZone.TimeZone
instance Data.Time.Format.ISO8601.ISO8601 Data.Time.LocalTime.Internal.LocalTime.LocalTime
instance Data.Time.Format.ISO8601.ISO8601 Data.Time.LocalTime.Internal.ZonedTime.ZonedTime
instance Data.Time.Format.ISO8601.ISO8601 Data.Time.Clock.Internal.UTCTime.UTCTime
instance Data.Time.Format.ISO8601.ISO8601 Data.Time.Calendar.CalendarDiffDays.CalendarDiffDays
instance Data.Time.Format.ISO8601.ISO8601 Data.Time.LocalTime.Internal.CalendarDiffTime.CalendarDiffTime
instance GHC.Read.Read Data.Time.Calendar.CalendarDiffDays.CalendarDiffDays
instance GHC.Show.Show Data.Time.Calendar.CalendarDiffDays.CalendarDiffDays
instance GHC.Read.Read Data.Time.LocalTime.Internal.CalendarDiffTime.CalendarDiffTime
instance GHC.Show.Show Data.Time.LocalTime.Internal.CalendarDiffTime.CalendarDiffTime
instance Data.Fixed.HasResolution Data.Time.Format.ISO8601.E16
instance Data.Fixed.HasResolution Data.Time.Format.ISO8601.E14
module Data.Time.Format
class FormatTime t
-- | Substitute various time-related information for each %-code in the
-- string, as per formatCharacter.
--
-- The general form is
-- %<modifier><width><alternate><specifier>,
-- where <modifier>, <width>, and
-- <alternate> are optional.
--
-- <modifier>
--
-- glibc-style modifiers can be used before the specifier (here marked as
-- z):
--
--
-- - %-z no padding
-- - %_z pad with spaces
-- - %0z pad with zeros
-- - %^z convert to upper case
-- - %#z convert to lower case (consistently, unlike
-- glibc)
--
--
-- <width>
--
-- Width digits can also be used after any modifiers and before the
-- specifier (here marked as z), for example:
--
--
-- - %4z pad to 4 characters (with default padding
-- character)
-- - %_12z pad with spaces to 12 characters
--
--
-- <alternate>
--
-- An optional E character indicates an alternate formatting.
-- Currently this only affects %Z and %z.
--
--
-- - %Ez alternate formatting
--
--
-- <specifier>
--
-- For all types (note these three are done by formatTime, not by
-- formatCharacter):
--
--
-- - %% %
-- - %t tab
-- - %n newline
--
--
-- TimeZone
--
-- For TimeZone (and ZonedTime and UTCTime):
--
--
-- - %z timezone offset in the format
-- ±HHMM
-- - %Ez timezone offset in the format
-- ±HH:MM
-- - %Z timezone name (or else offset in the format
-- ±HHMM)
-- - %EZ timezone name (or else offset in the format
-- ±HH:MM)
--
--
-- LocalTime
--
-- For LocalTime (and ZonedTime and UTCTime
-- and UniversalTime):
--
--
-- - %c as dateTimeFmt locale (e.g.
-- %a %b %e %H:%M:%S %Z %Y)
--
--
-- TimeOfDay
--
-- For TimeOfDay (and LocalTime and ZonedTime
-- and UTCTime and UniversalTime):
--
--
-- - %R same as %H:%M
-- - %T same as %H:%M:%S
-- - %X as timeFmt locale (e.g.
-- %H:%M:%S)
-- - %r as time12Fmt locale (e.g.
-- %I:%M:%S %p)
-- - %P day-half of day from (amPm
-- locale), converted to lowercase, am,
-- pm
-- - %p day-half of day from (amPm
-- locale), AM, PM
-- - %H hour of day (24-hour), 0-padded to two chars,
-- 00 - 23
-- - %k hour of day (24-hour), space-padded to two
-- chars, 0 - 23
-- - %I hour of day-half (12-hour), 0-padded to two
-- chars, 01 - 12
-- - %l hour of day-half (12-hour), space-padded to two
-- chars, 1 - 12
-- - %M minute of hour, 0-padded to two chars,
-- 00 - 59
-- - %S second of minute (without decimal part),
-- 0-padded to two chars, 00 - 60
-- - %q picosecond of second, 0-padded to twelve chars,
-- 000000000000 - 999999999999.
-- - %Q decimal point and fraction of second, up to 12
-- second decimals, without trailing zeros. For a whole number of
-- seconds, %Q omits the decimal point unless padding is
-- specified.
--
--
-- UTCTime and ZonedTime
--
-- For UTCTime and ZonedTime:
--
--
-- - %s number of whole seconds since the Unix epoch.
-- For times before the Unix epoch, this is a negative number. Note that
-- in %s.%q and %s%Q the decimals are positive, not
-- negative. For example, 0.9 seconds before the Unix epoch is formatted
-- as -1.1 with %s%Q.
--
--
-- DayOfWeek
--
-- For DayOfWeek (and Day and LocalTime and
-- ZonedTime and UTCTime and UniversalTime):
--
--
-- - %u day of week number for Week Date format,
-- 1 (= Monday) - 7 (= Sunday)
-- - %w day of week number, 0 (= Sunday) -
-- 6 (= Saturday)
-- - %a day of week, short form (snd from
-- wDays locale), Sun - Sat
-- - %A day of week, long form (fst from
-- wDays locale), Sunday -
-- Saturday
--
--
-- Month
--
-- For Month (and Day and LocalTime and
-- ZonedTime and UTCTime and UniversalTime):
--
--
-- - %Y year, no padding. Note %0Y and
-- %_Y pad to four chars
-- - %y year of century, 0-padded to two chars,
-- 00 - 99
-- - %C century, no padding. Note %0C and
-- %_C pad to two chars
-- - %B month name, long form (fst from
-- months locale), January -
-- December
-- - %b, %h month name, short form (snd
-- from months locale), Jan - Dec
-- - %m month of year, 0-padded to two chars,
-- 01 - 12
--
--
-- Day
--
-- For Day (and LocalTime and ZonedTime and
-- UTCTime and UniversalTime):
--
--
-- - %D same as %m/%d/%y
-- - %F same as %Y-%m-%d
-- - %x as dateFmt locale (e.g.
-- %m/%d/%y)
-- - %d day of month, 0-padded to two chars,
-- 01 - 31
-- - %e day of month, space-padded to two chars,
-- 1 - 31
-- - %j day of year, 0-padded to three chars,
-- 001 - 366
-- - %f century for Week Date format, no padding. Note
-- %0f and %_f pad to two chars
-- - %V week of year for Week Date format, 0-padded to
-- two chars, 01 - 53
-- - %U week of year where weeks start on Sunday (as
-- sundayStartWeek), 0-padded to two chars, 00 -
-- 53
-- - %W week of year where weeks start on Monday (as
-- mondayStartWeek), 0-padded to two chars, 00 -
-- 53
--
--
-- Duration types
--
-- The specifiers for DiffTime, NominalDiffTime,
-- CalendarDiffDays, and CalendarDiffTime are
-- semantically separate from the other types. Specifiers on negative
-- time differences will generally be negative (think rem rather
-- than mod).
--
-- NominalDiffTime and DiffTime
--
-- Note that a "minute" of DiffTime is simply 60 SI seconds,
-- rather than a minute of civil time. Use NominalDiffTime to
-- work with civil time, ignoring any leap seconds.
--
-- For NominalDiffTime and DiffTime:
--
--
-- - %w total whole weeks
-- - %d total whole days
-- - %D whole days of week
-- - %h total whole hours
-- - %H whole hours of day
-- - %m total whole minutes
-- - %M whole minutes of hour
-- - %s total whole seconds
-- - %Es total seconds, with decimal point and up to
-- <width> (default 12) decimal places, without trailing zeros. For
-- a whole number of seconds, %Es omits the decimal point unless
-- padding is specified.
-- - %0Es total seconds, with decimal point and
-- <width> (default 12) decimal places.
-- - %S whole seconds of minute
-- - %ES seconds of minute, with decimal point and up
-- to <width> (default 12) decimal places, without trailing zeros.
-- For a whole number of seconds, %ES omits the decimal point
-- unless padding is specified.
-- - %0ES seconds of minute as two digits, with decimal
-- point and <width> (default 12) decimal places.
--
--
-- CalendarDiffDays
--
-- For CalendarDiffDays (and CalendarDiffTime):
--
--
-- - %y total years
-- - %b total months
-- - %B months of year
-- - %w total weeks, not including months
-- - %d total days, not including months
-- - %D days of week
--
--
-- CalendarDiffTime
--
-- For CalendarDiffTime:
--
--
-- - %h total hours, not including months
-- - %H hours of day
-- - %m total minutes, not including months
-- - %M minutes of hour
-- - %s total whole seconds, not including months
-- - %Es total seconds, not including months, with
-- decimal point and up to <width> (default 12) decimal places,
-- without trailing zeros. For a whole number of seconds, %Es
-- omits the decimal point unless padding is specified.
-- - %0Es total seconds, not including months, with
-- decimal point and <width> (default 12) decimal places.
-- - %S whole seconds of minute
-- - %ES seconds of minute, with decimal point and up
-- to <width> (default 12) decimal places, without trailing zeros.
-- For a whole number of seconds, %ES omits the decimal point
-- unless padding is specified.
-- - %0ES seconds of minute as two digits, with decimal
-- point and <width> (default 12) decimal places.
--
formatTime :: FormatTime t => TimeLocale -> String -> t -> String
-- | Parses a time value given a format string. Missing information will be
-- derived from 1970-01-01 00:00 UTC (which was a Thursday). Supports the
-- same %-codes as formatTime, including %-,
-- %_ and %0 modifiers, however padding widths are not
-- supported. Case is not significant in the input string. Some
-- variations in the input are accepted:
--
--
-- - %z %Ez accepts any of ±HHMM or
-- ±HH:MM.
-- - %Z %EZ accepts any string of letters, or
-- any of the formats accepted by %z.
-- - %0Y accepts exactly four digits.
-- - %0G accepts exactly four digits.
-- - %0C accepts exactly two digits.
-- - %0f accepts exactly two digits.
--
--
-- For example, to parse a date in YYYY-MM-DD format, while allowing the
-- month and date to have optional leading zeros (notice the -
-- modifier used for %m and %d):
--
--
-- Prelude Data.Time> parseTimeM True defaultTimeLocale "%Y-%-m-%-d" "2010-3-04" :: Maybe Day
-- Just 2010-03-04
--
parseTimeM :: (MonadFail m, ParseTime t) => Bool -> TimeLocale -> String -> String -> m t
-- | Parses a time value given a list of pairs of format and input.
-- Resulting value is constructed from all provided specifiers.
parseTimeMultipleM :: (MonadFail m, ParseTime t) => Bool -> TimeLocale -> [(String, String)] -> m t
-- | Parse a time value given a format string. Fails if the input could not
-- be parsed using the given format. See parseTimeM for details.
parseTimeOrError :: ParseTime t => Bool -> TimeLocale -> String -> String -> t
-- | Parse a time value given a format string. See parseTimeM for
-- details.
readSTime :: ParseTime t => Bool -> TimeLocale -> String -> ReadS t
-- | Parse a time value given a format string. See parseTimeM for
-- details.
readPTime :: ParseTime t => Bool -> TimeLocale -> String -> ReadP t
-- | The class of types which can be parsed given a UNIX-style time format
-- string.
class ParseTime t
data TimeLocale
TimeLocale :: [(String, String)] -> [(String, String)] -> (String, String) -> String -> [TimeZone] -> TimeLocale
-- | full and abbreviated week days, starting with Sunday
[wDays] :: TimeLocale -> [(String, String)]
-- | full and abbreviated months
[months] :: TimeLocale -> [(String, String)]
-- | AM/PM symbols
[amPm] :: TimeLocale -> (String, String)
-- | formatting strings
-- | formatting strings
-- | formatting strings
-- | formatting strings
[dateTimeFmt, dateFmt, timeFmt, time12Fmt] :: TimeLocale -> String
-- | time zones known by name
[knownTimeZones] :: TimeLocale -> [TimeZone]
-- | Locale representing American usage.
--
-- knownTimeZones contains only the ten time-zones mentioned in
-- RFC 822 sec. 5: "UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT",
-- "PST", "PDT". Note that the parsing functions will regardless parse
-- "UTC", single-letter military time-zones, and +HHMM format.
defaultTimeLocale :: TimeLocale
-- | Construct format string according to ISO-8601.
--
-- The Maybe String argument allows to supply an optional time
-- specification. E.g.:
--
--
-- iso8601DateFormat Nothing == "%Y-%m-%d" -- i.e. YYYY-MM-DD
-- iso8601DateFormat (Just "%H:%M:%S") == "%Y-%m-%dT%H:%M:%S" -- i.e. YYYY-MM-DDTHH:MM:SS
--
-- | Deprecated: use Data.Time.Format.ISO8601 functions
-- instead
iso8601DateFormat :: Maybe String -> String
-- | Format string according to RFC822.
rfc822DateFormat :: String
module Data.Time.LocalTime
-- | A TimeZone is a whole number of minutes offset from UTC, together with
-- a name and a "just for summer" flag.
data TimeZone
TimeZone :: Int -> Bool -> String -> TimeZone
-- | The number of minutes offset from UTC. Positive means local time will
-- be later in the day than UTC.
[timeZoneMinutes] :: TimeZone -> Int
-- | Is this time zone just persisting for the summer?
[timeZoneSummerOnly] :: TimeZone -> Bool
-- | The name of the zone, typically a three- or four-letter acronym.
[timeZoneName] :: TimeZone -> String
-- | Text representing the offset of this timezone, such as "-0800" or
-- "+0400" (like %z in formatTime).
timeZoneOffsetString :: TimeZone -> String
-- | Text representing the offset of this timezone, such as "-0800" or
-- "+0400" (like %z in formatTime), with arbitrary padding.
timeZoneOffsetString' :: Maybe Char -> TimeZone -> String
-- | Create a nameless non-summer timezone for this number of minutes.
minutesToTimeZone :: Int -> TimeZone
-- | Create a nameless non-summer timezone for this number of hours.
hoursToTimeZone :: Int -> TimeZone
-- | The UTC time zone.
utc :: 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:
--
--
-- - The value of TZ environment variable (if set)
-- - 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:
--
--
-- - The value of TZ environment variable (if set). See
-- here for how Windows interprets this variable.
-- - The system time zone, configured in Settings
--
getTimeZone :: UTCTime -> IO TimeZone
-- | Get the configured time-zone for the current time.
getCurrentTimeZone :: IO TimeZone
-- | 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.
data TimeOfDay
TimeOfDay :: Int -> Int -> Pico -> TimeOfDay
-- | range 0 - 23
[todHour] :: TimeOfDay -> Int
-- | range 0 - 59
[todMin] :: TimeOfDay -> Int
-- | Note that 0 <= todSec < 61, accomodating leap seconds.
-- Any local minute may have a leap second, since leap seconds happen in
-- all zones simultaneously
[todSec] :: TimeOfDay -> Pico
-- | Hour zero
midnight :: TimeOfDay
-- | Hour twelve
midday :: TimeOfDay
makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe 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.
timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay)
-- | Convert a count of days and a time of day since midnight into a period
-- of time.
daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime
-- | Convert a time of day in UTC to a time of day in some timezone,
-- together with a day adjustment.
utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
-- | Convert a time of day in some timezone to a time of day in UTC,
-- together with a day adjustment.
localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
-- | Get the time of day given a time since midnight. Time more than 24h
-- will be converted to leap-seconds.
timeToTimeOfDay :: DiffTime -> TimeOfDay
-- | Same as timeToTimeOfDay.
pastMidnight :: DiffTime -> TimeOfDay
-- | Get the time since midnight for a given time of day.
timeOfDayToTime :: TimeOfDay -> DiffTime
-- | Same as timeOfDayToTime.
sinceMidnight :: TimeOfDay -> DiffTime
-- | Get the time of day given the fraction of a day since midnight.
dayFractionToTimeOfDay :: Rational -> TimeOfDay
-- | Get the fraction of a day since midnight given a time of day.
timeOfDayToDayFraction :: TimeOfDay -> Rational
data CalendarDiffTime
CalendarDiffTime :: Integer -> NominalDiffTime -> CalendarDiffTime
[ctMonths] :: CalendarDiffTime -> Integer
[ctTime] :: CalendarDiffTime -> NominalDiffTime
calendarTimeDays :: CalendarDiffDays -> CalendarDiffTime
calendarTimeTime :: NominalDiffTime -> CalendarDiffTime
-- | Scale by a factor. Note that scaleCalendarDiffTime (-1) will
-- not perfectly invert a duration, due to variable month lengths.
scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime
-- | 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.
data LocalTime
LocalTime :: Day -> TimeOfDay -> LocalTime
[localDay] :: LocalTime -> Day
[localTimeOfDay] :: LocalTime -> TimeOfDay
-- | addLocalTime a b = a + b
addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime
-- | diffLocalTime a b = a - b
diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime
-- | Get the local time of a UTC time in a time zone.
utcToLocalTime :: TimeZone -> UTCTime -> LocalTime
-- | Get the UTC time of a local time in a time zone.
localTimeToUTC :: TimeZone -> LocalTime -> UTCTime
-- | Get the local time of a UT1 time on a particular meridian (in degrees,
-- positive is East).
ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime
-- | Get the UT1 time of a local time on a particular meridian (in degrees,
-- positive is East).
localTimeToUT1 :: Rational -> LocalTime -> UniversalTime
-- | 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.
data ZonedTime
ZonedTime :: LocalTime -> TimeZone -> ZonedTime
[zonedTimeToLocalTime] :: ZonedTime -> LocalTime
[zonedTimeZone] :: ZonedTime -> TimeZone
utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime
zonedTimeToUTC :: ZonedTime -> UTCTime
getZonedTime :: IO ZonedTime
utcToLocalZonedTime :: UTCTime -> IO ZonedTime
-- | Types and functions for UTC and UT1
module Data.Time.Clock
-- | The Modified Julian Date is the day with the fraction of the day,
-- measured from UT midnight. It's used to represent UT1, which is time
-- as measured by the earth's rotation, adjusted for various wobbles.
newtype UniversalTime
ModJulianDate :: Rational -> UniversalTime
[getModJulianDate] :: UniversalTime -> Rational
-- | This is a length of time, as measured by a clock. Conversion functions
-- such as fromInteger and realToFrac will treat it as
-- seconds. For example, (0.010 :: DiffTime) corresponds to 10
-- milliseconds.
--
-- It has a precision of one picosecond (= 10^-12 s). Enumeration
-- functions will treat it as picoseconds.
data DiffTime
-- | Create a DiffTime which represents an integral number of
-- seconds.
secondsToDiffTime :: Integer -> DiffTime
-- | Create a DiffTime from a number of picoseconds.
picosecondsToDiffTime :: Integer -> DiffTime
-- | Get the number of picoseconds in a DiffTime.
diffTimeToPicoseconds :: DiffTime -> Integer
-- | This is the simplest representation of UTC. It consists of the day
-- number, and a time offset from midnight. Note that if a day has a leap
-- second added to it, it will have 86401 seconds.
data UTCTime
UTCTime :: Day -> DiffTime -> UTCTime
-- | the day
[utctDay] :: UTCTime -> Day
-- | the time from midnight, 0 <= t < 86401s (because of
-- leap-seconds)
[utctDayTime] :: UTCTime -> DiffTime
-- | This is a length of time, as measured by UTC. It has a precision of
-- 10^-12 s.
--
-- Conversion functions such as fromInteger and realToFrac
-- will treat it as seconds. For example, (0.010 ::
-- NominalDiffTime) corresponds to 10 milliseconds.
--
-- It has a precision of one picosecond (= 10^-12 s). Enumeration
-- functions will treat it as picoseconds.
--
-- It ignores leap-seconds, so it's not necessarily a fixed amount of
-- clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime =
-- 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.
data NominalDiffTime
-- | Create a NominalDiffTime from a number of seconds.
secondsToNominalDiffTime :: Pico -> NominalDiffTime
-- | Get the seconds in a NominalDiffTime.
nominalDiffTimeToSeconds :: NominalDiffTime -> Pico
-- | One day in NominalDiffTime.
nominalDay :: NominalDiffTime
-- | addUTCTime a b = a + b
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
-- | diffUTCTime a b = a - b
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime
-- | Get the current UTCTime from the system clock.
getCurrentTime :: IO UTCTime
-- | The resolution of getSystemTime, getCurrentTime,
-- getPOSIXTime. On UNIX systems this uses
-- clock_getres, which may be wrong on WSL2.
getTime_resolution :: DiffTime
-- | TAI and leap-second maps for converting to UTC: most people won't need
-- this module.
module Data.Time.Clock.TAI
-- | AbsoluteTime is TAI, time as measured by a clock.
data AbsoluteTime
-- | The epoch of TAI, which is 1858-11-17 00:00:00 TAI.
taiEpoch :: AbsoluteTime
-- | addAbsoluteTime a b = a + b
addAbsoluteTime :: DiffTime -> AbsoluteTime -> AbsoluteTime
-- | diffAbsoluteTime a b = a - b
diffAbsoluteTime :: AbsoluteTime -> AbsoluteTime -> DiffTime
taiNominalDayStart :: Day -> AbsoluteTime
-- | TAI - UTC during this day. No table is provided, as any program
-- compiled with it would become out of date in six months.
type LeapSecondMap = Day -> Maybe Int
utcDayLength :: LeapSecondMap -> Day -> Maybe DiffTime
utcToTAITime :: LeapSecondMap -> UTCTime -> Maybe AbsoluteTime
taiToUTCTime :: LeapSecondMap -> AbsoluteTime -> Maybe UTCTime
-- | TAI clock, if it exists. Note that it is unlikely to be set correctly,
-- without due care and attention.
taiClock :: Maybe (DiffTime, IO AbsoluteTime)
instance GHC.Show.Show Data.Time.Clock.Internal.AbsoluteTime.AbsoluteTime
module Data.Time.Calendar
-- | The Modified Julian Day is a standard count of days, with zero being
-- the day 1858-11-17.
newtype Day
ModifiedJulianDay :: Integer -> Day
[toModifiedJulianDay] :: Day -> Integer
addDays :: Integer -> Day -> Day
diffDays :: Day -> Day -> Integer
-- | The class of types which can be represented as a period of days.
class Ord p => DayPeriod p
-- | Returns the first Day in a period of days.
periodFirstDay :: DayPeriod p => p -> Day
-- | Returns the last Day in a period of days.
periodLastDay :: DayPeriod p => p -> Day
-- | Get the period this day is in.
dayPeriod :: DayPeriod p => Day -> p
-- | A list of all the days in this period.
periodAllDays :: DayPeriod p => p -> [Day]
-- | The number of days in this period.
periodLength :: DayPeriod p => p -> Int
-- | Get the period this day is in, with the 1-based day number within the
-- period.
--
--
-- periodFromDay (periodFirstDay p) = (p,1)
--
periodFromDay :: DayPeriod p => Day -> (p, Int)
-- | Inverse of periodFromDay.
periodToDay :: DayPeriod p => p -> Int -> Day
-- | Validating inverse of periodFromDay.
periodToDayValid :: DayPeriod p => p -> Int -> Maybe Day
data CalendarDiffDays
CalendarDiffDays :: Integer -> Integer -> CalendarDiffDays
[cdMonths] :: CalendarDiffDays -> Integer
[cdDays] :: CalendarDiffDays -> Integer
calendarDay :: CalendarDiffDays
calendarWeek :: CalendarDiffDays
calendarMonth :: CalendarDiffDays
calendarYear :: CalendarDiffDays
-- | Scale by a factor. Note that scaleCalendarDiffDays (-1) will
-- not perfectly invert a duration, due to variable month lengths.
scaleCalendarDiffDays :: Integer -> CalendarDiffDays -> CalendarDiffDays
-- | Year of Common Era (when positive).
type Year = Integer
-- | Also known as Anno Domini.
pattern CommonEra :: Integer -> Year
-- | Also known as Before Christ. Note that Year 1 = 1 CE, and the previous
-- Year 0 = 1 BCE. CommonEra and BeforeCommonEra form a
-- COMPLETE set.
pattern BeforeCommonEra :: Integer -> Year
-- | Month of year, in range 1 (January) to 12 (December).
type MonthOfYear = Int
pattern January :: MonthOfYear
pattern February :: MonthOfYear
pattern March :: MonthOfYear
pattern April :: MonthOfYear
pattern May :: MonthOfYear
pattern June :: MonthOfYear
pattern July :: MonthOfYear
pattern August :: MonthOfYear
pattern September :: MonthOfYear
pattern October :: MonthOfYear
pattern November :: MonthOfYear
-- | The twelve MonthOfYear patterns form a COMPLETE set.
pattern December :: MonthOfYear
-- | Day of month, in range 1 to 31.
type DayOfMonth = Int
-- | Convert to proleptic Gregorian calendar.
toGregorian :: Day -> (Year, MonthOfYear, DayOfMonth)
-- | Convert from proleptic Gregorian calendar. Invalid values will be
-- clipped to the correct range, month first, then day.
fromGregorian :: 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.
pattern YearMonthDay :: Year -> MonthOfYear -> DayOfMonth -> Day
-- | Convert from proleptic Gregorian calendar. Invalid values will return
-- Nothing
fromGregorianValid :: Year -> MonthOfYear -> DayOfMonth -> Maybe Day
-- | Show in ISO 8601 format (yyyy-mm-dd)
showGregorian :: Day -> String
-- | The number of days in a given month according to the proleptic
-- Gregorian calendar.
gregorianMonthLength :: Year -> MonthOfYear -> DayOfMonth
-- | 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.
addGregorianMonthsClip :: Integer -> Day -> Day
-- | Add months, with days past the last day of the month rolling over to
-- the next month. For instance, 2005-01-30 + 1 month = 2005-03-02.
addGregorianMonthsRollOver :: Integer -> Day -> Day
-- | 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.
addGregorianYearsClip :: Integer -> Day -> Day
-- | 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.
addGregorianYearsRollOver :: Integer -> Day -> Day
-- | Add months (clipped to last day), then add days
addGregorianDurationClip :: CalendarDiffDays -> Day -> Day
-- | Add months (rolling over to next month), then add days
addGregorianDurationRollOver :: CalendarDiffDays -> Day -> Day
-- | Calendrical difference, with as many whole months as possible
diffGregorianDurationClip :: Day -> Day -> CalendarDiffDays
-- | Calendrical difference, with as many whole months as possible.
diffGregorianDurationRollOver :: Day -> Day -> CalendarDiffDays
-- | Is this year a leap year according to the proleptic Gregorian
-- calendar?
isLeapYear :: Year -> Bool
data DayOfWeek
Monday :: DayOfWeek
Tuesday :: DayOfWeek
Wednesday :: DayOfWeek
Thursday :: DayOfWeek
Friday :: DayOfWeek
Saturday :: DayOfWeek
Sunday :: DayOfWeek
dayOfWeek :: Day -> DayOfWeek
-- | dayOfWeekDiff a b = a - b in range 0 to 6. The number of days
-- from b to the next a.
dayOfWeekDiff :: DayOfWeek -> DayOfWeek -> Int
-- | The first day-of-week on or after some day
firstDayOfWeekOnAfter :: DayOfWeek -> Day -> Day
-- | Returns a week containing the given Day where the first day is
-- the DayOfWeek specified.
--
-- Examples:
--
--
-- >>> weekAllDays Sunday (YearMonthDay 2022 02 21)
-- [YearMonthDay 2022 2 20 .. YearMonthDay 2022 2 26]
--
--
--
-- >>> weekAllDays Monday (YearMonthDay 2022 02 21)
-- [YearMonthDay 2022 2 21 .. YearMonthDay 2022 2 27]
--
--
--
-- >>> weekAllDays Tuesday (YearMonthDay 2022 02 21)
-- [YearMonthDay 2022 2 15 .. YearMonthDay 2022 2 21]
--
weekAllDays :: DayOfWeek -> Day -> [Day]
-- | Returns the first day of a week containing the given Day.
--
-- Examples:
--
--
-- >>> weekFirstDay Sunday (YearMonthDay 2022 02 21)
-- YearMonthDay 2022 2 20
--
--
--
-- >>> weekFirstDay Monday (YearMonthDay 2022 02 21)
-- YearMonthDay 2022 2 21
--
--
--
-- >>> weekFirstDay Tuesday (YearMonthDay 2022 02 21)
-- YearMonthDay 2022 2 15
--
weekFirstDay :: DayOfWeek -> Day -> Day
-- | Returns the last day of a week containing the given Day.
--
-- Examples:
--
--
-- >>> weekLastDay Sunday (YearMonthDay 2022 02 21)
-- YearMonthDay 2022 2 26
--
--
--
-- >>> weekLastDay Monday (YearMonthDay 2022 02 21)
-- YearMonthDay 2022 2 27
--
--
--
-- >>> weekLastDay Tuesday (YearMonthDay 2022 02 21)
-- YearMonthDay 2022 2 21
--
weekLastDay :: DayOfWeek -> Day -> Day
module Data.Time.Calendar.Easter
-- | The next Sunday strictly after a given day.
sundayAfter :: Day -> Day
-- | Given a year, find the Paschal full moon according to Orthodox
-- Christian tradition
orthodoxPaschalMoon :: Year -> Day
-- | Given a year, find Easter according to Orthodox Christian tradition
orthodoxEaster :: Year -> Day
-- | Given a year, find the Paschal full moon according to the Gregorian
-- method
gregorianPaschalMoon :: Year -> Day
-- | Given a year, find Easter according to the Gregorian method
gregorianEaster :: Year -> Day
-- | Quick Start
--
-- Use these types for time regardless of location (not caring about
-- leap-seconds):
--
--
--
-- Use these types for the ways people refer to time and time
-- differences:
--
--
--
-- Use this for low-latency timing:
--
--
--
-- These are less commonly needed:
--
--
module Data.Time