Timex.Parse.DateTime.Parser
This is the base plugin behavior for all Timex date/time string parsers.
Summary↑
parse!(date_string, format_string, tokenizer \\ Timex.Parse.DateTime.Tokenizers.Default) | |
parse(date_string, format_string) | Parses a date/time string using the default parser |
parse(date_string, format_string, tokenizer) | Parses a date/time string using the provided tokenizer. Tokenizers must implement the |
Functions
Specs:
- parse(binary, binary) :: {:ok, %Timex.DateTime{calendar: term, day: term, hour: term, minute: term, month: term, ms: term, second: term, timezone: term, year: term}} | {:error, term}
Parses a date/time string using the default parser.
Examples
iex> use Timex
...> {:ok, dt} = Elixir.Timex.Parse.DateTime.Parser.parse("2014-07-29T00:20:41.196Z", "{ISOz}")
...> dt.year
2014
...> dt.month
7
...> dt.day
29
...> dt.timezone.full_name
"UTC"
Specs:
- parse(binary, binary, atom) :: {:ok, %Timex.DateTime{calendar: term, day: term, hour: term, minute: term, month: term, ms: term, second: term, timezone: term, year: term}} | {:error, term}
Parses a date/time string using the provided tokenizer. Tokenizers must implement the Timex.Parse.DateTime.Tokenizer
behaviour.
Examples
iex> use Timex
...> {:ok, dt} = Elixir.Timex.Parse.DateTime.Parser.parse("2014-07-29T00:30:41.196-0200", "{ISO}", Timex.Parse.DateTime.Tokenizers.Default)
...> dt.year
2014
...> dt.month
7
...> dt.day
29
...> dt.timezone.full_name
"Etc/GMT+2"
parse!(date_string, format_string, tokenizer \\ Timex.Parse.DateTime.Tokenizers.Default)
Specs:
- parse!(String.t, String.t, atom | nil) :: %Timex.DateTime{calendar: term, day: term, hour: term, minute: term, month: term, ms: term, second: term, timezone: term, year: term} | no_return