erlang % AFAIK, no datetime-parsing library exists; 'parse_to_datetime' is a simplistic, problem-specific hack
LocalDateTime = erlang:universaltime_to_localtime(parse_to_datetime("2008-05-06 13:29:34")),
-module(datetime).
-export([start/0]).
start() ->
% AFAIK, no datetime-parsing library exists; 'parse_to_datetime' is a simplistic, problem-specific hack
LocalDateTime = erlang:universaltime_to_localtime(parse_to_datetime("2008-05-06 13:29:34")),
io:format("Stored as: ~w represents: ~s~n", [LocalDateTime, httpd_util:rfc1123_date(LocalDateTime)]),
parse_to_datetime(DTS) ->
NDTS = DTS ++ ":00",
Parse = fun (Start, Length) -> {I, _} = string:to_integer(string:substr(NDTS, Start, Length)), I end,
{{Parse(1, 4), Parse(6, 2), Parse(9, 2)}, {Parse(12, 2), Parse(15, 2), Parse(18, 2)}}.