Timex.DateFormat
Date formatting and parsing.
This module provides an interface and core implementation for converting date values into strings (formatting) or the other way around (parsing) according to the specified template.
Multiple template formats are supported, each one provided by a separate module. One can also implement custom formatters for use with this module.
Summary
Functions
Converts date values to strings according to the given template (aka format string)
Same as format/2
, but takes a custom formatter
Raising version of format/2
. Returns a string with formatted date or raises a FormatError
Raising version of format/3
. Returns a string with formatted date or raises a FormatError
Parses the date encoded in string
according to the template
Parses the date encoded in string
according to the template by using the provided formatter
Raising version of parse/2
. Returns a DateTime struct, or raises a ParseError
Raising version of parse/3
. Returns a DateTime struct, or raises a ParseError
Verifies the validity of the given format string according to the provided formatter, defaults to the Default formatter if one is not provided
Functions
Specs
Converts date values to strings according to the given template (aka format string).
Specs
Same as format/2
, but takes a custom formatter.
Specs
Raising version of format/2
. Returns a string with formatted date or raises a FormatError
.
Specs
Raising version of format/3
. Returns a string with formatted date or raises a FormatError
.
Specs
Parses the date encoded in string
according to the template.
Specs
Parses the date encoded in string
according to the template by using the provided formatter.
Specs
Raising version of parse/2
. Returns a DateTime struct, or raises a ParseError
.
Specs
Raising version of parse/3
. Returns a DateTime struct, or raises a ParseError
.
Specs
validate(String.t, atom) :: :ok | {:error, term}
Verifies the validity of the given format string according to the provided formatter, defaults to the Default formatter if one is not provided.
Returns :ok
if the format string is clean, { :error, <reason> }
otherwise.