| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
The contents of this module is liable to change, or disappear entirely. Please let me know if you depend on anything here.
A text format for a type
| MkFormat | |
Fields
| |
quotBy :: (Real a, Integral b) => a -> a -> b Source
remBy :: Real a => a -> a -> a Source
formatGeneral :: Bool -> Bool -> Int -> Char -> (TimeLocale -> PadOption -> t -> String) -> FormatOptions -> t -> String Source
formatNumber :: ShowPadded i => Bool -> Int -> Char -> (t -> i) -> FormatOptions -> t -> String Source
formatNumberStd :: Int -> (t -> Integer) -> FormatOptions -> t -> String Source
formatString :: (TimeLocale -> t -> String) -> FormatOptions -> t -> String Source
formatTime :: FormatTime t => TimeLocale -> String -> t -> String Source
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%_z%0z%^z%#z<width>Width digits can also be used after any modifiers and before the specifier (here marked as z), for example:
%4z%_12z<alternate>An optional E character indicates an alternate formatting. Currently this only affects %Z and %z.
%Ez<specifier>For all types (note these three are done by formatTime, not by formatCharacter):
%%%%t%nTimeZoneFor TimeZone (and ZonedTime and UTCTime):
%z±HHMM
%Ez±HH:MM
%Z±HHMM)%EZ±HH:MM)LocalTimeFor LocalTime (and ZonedTime and UTCTime and UniversalTime):
%cdateTimeFmt locale (e.g. %a %b %e %H:%M:%S %Z %Y)TimeOfDayFor TimeOfDay (and LocalTime and ZonedTime and UTCTime and UniversalTime):
%R%H:%M
%T%H:%M:%S
%XtimeFmt locale (e.g. %H:%M:%S)%rtime12Fmt locale (e.g. %I:%M:%S %p)%PamPm locale), converted to lowercase, am, pm
%pamPm locale), AM, PM
%H00 - 23
%k 0 - 23
%I01 - 12
%l 1 - 12
%M00 - 59
%S00 - 60
%q000000000000 - 999999999999.%Q%Q omits the decimal point unless padding is specified.UTCTime and ZonedTime
For UTCTime and ZonedTime:
%s%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.DayOfWeekFor DayOfWeek (and Day and LocalTime and ZonedTime and UTCTime and UniversalTime):
%u1 (= Monday) - 7 (= Sunday)%w0 (= Sunday) - 6 (= Saturday)%asnd from wDays locale), Sun - Sat
%Afst from wDays locale), Sunday - Saturday
MonthFor Month (and Day and LocalTime and ZonedTime and UTCTime and UniversalTime):
%Y%0Y and %_Y pad to four chars%y00 - 99
%C%0C and %_C pad to two chars%Bfst from months locale), January - December
%b, %h
snd from months locale), Jan - Dec
%m01 - 12
DayFor Day (and LocalTime and ZonedTime and UTCTime and UniversalTime):
%D%m/%d/%y
%F%Y-%m-%d
%xdateFmt locale (e.g. %m/%d/%y)%d01 - 31
%e 1 - 31
%j001 - 366
%f%0f and %_f pad to two chars%V01 - 53
%UsundayStartWeek), 0-padded to two chars, 00 - 53
%WmondayStartWeek), 0-padded to two chars, 00 - 53
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%d%D%h%H%m%M%s%Es%Es omits the decimal point unless padding is specified.%0Es%S%ES%ES omits the decimal point unless padding is specified.%0ESCalendarDiffDaysFor CalendarDiffDays (and CalendarDiffTime):
%y%b%B%w%d%DCalendarDiffTimeFor CalendarDiffTime:
%h%H%m%M%s%Es%Es omits the decimal point unless padding is specified.%0Es%S%ES%ES omits the decimal point unless padding is specified.%0ESshowPaddedFixed :: HasResolution a => PadOption -> PadOption -> Fixed a -> String Source
showPaddedFixedFraction :: HasResolution a => PadOption -> Fixed a -> String Source
class (Num t, Ord t, Show t) => ShowPadded t Source
showPaddedNum
| ShowPadded Integer Source | |
Defined in Data.Time.Calendar.Private MethodsshowPaddedNum :: PadOption -> Integer -> String | |
| ShowPadded Int Source | |
Defined in Data.Time.Calendar.Private MethodsshowPaddedNum :: PadOption -> Int -> String | |
type FormatNumericPadding = Maybe Char Source
data FormatOptions Source
| MkFormatOptions | |
Fields | |
class FormatTime t where Source
formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> t -> String) Source
Since: time-1.9.1
durationParseTimeSpecifier :: TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String Source
parseSpecifiers :: ParseTime t => Proxy t -> TimeLocale -> String -> ReadP [(Char, String)] Source
timeParseTimeSpecifier :: TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String Source
timeSubstituteTimeSpecifier :: TimeLocale -> Char -> Maybe String Source
data ParseNumericPadding Source
| NoPadding | |
| SpacePadding | |
| ZeroPadding |
class ParseTime t where Source
The class of types which can be parsed given a UNIX-style time format string.
substituteTimeSpecifier :: Proxy t -> TimeLocale -> Char -> Maybe String Source
Since: time-1.9.1
parseTimeSpecifier :: Proxy t -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String Source
Get the string corresponding to the given format specifier.
Since: time-1.9.1
| :: TimeLocale | The time locale. |
| -> [(Char, String)] | Pairs of format characters and the corresponding part of the input. |
| -> Maybe t |
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.
Since: time-1.9.1
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/9.12.1/docs/libraries/time-1.14-40b8/Data-Time-Format-Internal.html