time-1.4: A time library

Safe HaskellSafe-Infered

Data.Time.Format.Parse

Contents

Synopsis

UNIX-style parsing

parseTimeSource

Arguments

:: ParseTime t 
=> TimeLocale

Time locale.

-> String

Format string.

-> String

Input string.

-> Maybe t

The time value, or Nothing 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. Leading and trailing whitespace is accepted. Case is not significant. Some variations in the input are accepted:

%z
accepts any of -HHMM or -HH:MM.
%Z
accepts any string of letters, or any of the formats accepted by %z.

readTimeSource

Arguments

:: ParseTime t 
=> 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 parseTime for details.

readsTimeSource

Arguments

:: ParseTime t 
=> TimeLocale

Time locale.

-> String

Format string

-> ReadS t 

Parse a time value given a format string. See parseTime for details.

class ParseTime t whereSource

The class of types which can be parsed given a UNIX-style time format string.

Methods

buildTimeSource

Arguments

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