| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
type NumericPadOption = Maybe Char Source
class FormatTime t where Source
formatCharacter :: Char -> Maybe (TimeLocale -> Maybe NumericPadOption -> 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.
For all types (note these three are done here, not by formatCharacter):
%%%%t%nglibc-style modifiers can be used before the letter (here marked as z):
%-z%_z%0z%^z%#zFor TimeZone (and ZonedTime and UTCTime):
%z-HHMM.%ZFor LocalTime (and ZonedTime and UTCTime):
%cdateTimeFmt locale (e.g. %a %b %e %H:%M:%S %Z %Y)For TimeOfDay (and LocalTime and ZonedTime and UTCTime):
%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 produces the empty string.%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.For Day (and LocalTime and ZonedTime and UTCTime):
%D%m/%d/%y
%F%Y-%m-%d
%xdateFmt locale (e.g. %m/%d/%y)%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
%d01 - 31
%e 1 - 31
%j001 - 366
%G%0G and %_G pad to four chars%g00 - 99
%f%0f and %_f pad to two chars%V01 - 53
%u1 - 7
%asnd from wDays locale), Sun - Sat
%Afst from wDays locale), Sunday - Saturday
%UsundayStartWeek), 0-padded to two chars, 00 - 53
%w0 (= Sunday) - 6 (= Saturday)%WmondayStartWeek), 0-padded to two chars, 00 - 53
| :: (Monad m, ParseTime t) | |
| => Bool | Accept leading and trailing whitespace? |
| -> TimeLocale | Time locale. |
| -> String | Format string. |
| -> String | Input string. |
| -> m t | Return the time value, or fail if the input could not be parsed using the given format. |
Parses a time value given a format string. Supports the same %-codes as formatTime, including %-, %_ and %0 modifiers. Case is not significant. Some variations in the input are accepted:
%z-HHMM or -HH:MM.%Z%z.%0Y%0G%0C%0f| :: ParseTime t | |
| => Bool | Accept leading and trailing whitespace? |
| -> TimeLocale | Time locale. |
| -> String | Format string. |
| -> String | Input string. |
| -> t | The time value. |
Parse a time value given a format string. Fails if the input could not be parsed using the given format. See parseTimeM for details.
| :: ParseTime t | |
| => Bool | Accept leading whitespace? |
| -> TimeLocale | Time locale. |
| -> String | Format string |
| -> ReadS t |
Parse a time value given a format string. See parseTimeM for details.
| :: ParseTime t | |
| => Bool | Accept leading whitespace? |
| -> TimeLocale | Time locale. |
| -> String | Format string |
| -> ReadP t |
Parse a time value given a format string. See parseTimeM for details.
| :: ParseTime t | |
| => TimeLocale | Time locale. |
| -> String | Format string. |
| -> String | Input string. |
| -> Maybe t | The time value, or |
Deprecated: use "parseTimeM True" instead
| :: ParseTime t | |
| => TimeLocale | Time locale. |
| -> String | Format string. |
| -> String | Input string. |
| -> t | The time value. |
Deprecated: use "parseTimeOrError True" instead
| :: ParseTime t | |
| => TimeLocale | Time locale. |
| -> String | Format string |
| -> ReadS t |
Deprecated: use "readSTime True" instead
class ParseTime t where Source
The class of types which can be parsed given a UNIX-style time format string.
| :: TimeLocale | The time locale. |
| -> [(Char, String)] | Pairs of format characters and the corresponding part of the input. |
| -> 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.
data TimeLocale Source
| TimeLocale | |
Fields
| |
defaultTimeLocale :: TimeLocale Source
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 single-letter military time-zones and +HHMM format.
iso8601DateFormat :: Maybe String -> String Source
Construct format string according to ISO-8601.
The Maybe String argument allows to supply an optional time specification. E.g.:
iso8601DateFormatNothing == "%Y-%m-%d" -- i.e.YYYY-MM-DDiso8601DateFormat(Just "%H:%M:%S") == "%Y-%m-%dT%H:%M:%S" -- i.e.YYYY-MM-DDTHH:MM:SS
rfc822DateFormat :: String Source
Format string according to RFC822.
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/7.10.3/docs/html/libraries/time-1.5.0.1/Data-Time-Format.html