XMLRPC.DateTime (XMLRPC v1.4.2) View Source

Struct to store a date-time in xml-rpc format (a variation on ISO 8601).

Note, there is significant ambiguity in the formatting of date-time in xml-rpc. This is a thin wrapper around a basic parser, but knowledge of the API you are trying to connect to will be valuable. Consider writing your own decoder (and perhaps encoder) to speak to non standard end-points...

Link to this section Summary

Functions

Create a new datetime in the (odd) format that the XMLRPC spec claims is ISO 8601.

Attempt to parse a returned date. Note there is significant ambiguity around what constitutes an valid date... The spec says no hyphens between date parts and no timezone. However, servers in the field sometimes seem to return ISO 8601 dates...

Link to this section Types

Specs

t() :: %XMLRPC.DateTime{raw: String.t()}

Link to this section Functions

Create a new datetime in the (odd) format that the XMLRPC spec claims is ISO 8601.

iex> XMLRPC.DateTime.new({{2015,6,9},{9,7,2}})
%XMLRPC.DateTime{raw: "20150609T09:07:02"}
Link to this function

to_erlang_date(date_time)

View Source

Attempt to parse a returned date. Note there is significant ambiguity around what constitutes an valid date... The spec says no hyphens between date parts and no timezone. However, servers in the field sometimes seem to return ISO 8601 dates...

We attempt to be generous in parsing, but no attempt is made to handle timezones. For more accurate parsing, including handling timezones, see the Calendar library

iex>XMLRPC.DateTime.to_erlang_date(%XMLRPC.DateTime{raw: "20150609T09:07:02"})
{:ok, {{2015, 6, 9}, {9, 7, 2}}}