build a time&date string

info <>
Fri Jul 10 18:31:57 CEST 2009


Hi Jacob,

Yes for the splitting:
{ok, [Year, Mon, Day], []} = io_lib:fread("~2d~2d~2d", Date),
{ok, [Hour, Min, Sec], []} = io_lib:fread("~2d~2d~2d", Time),
and ...
Args = [Year, Mon, Day, Hour, Min, Sec],
S = io_lib:format("~B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ", Args),
lists:flatten(S)I must find now how to add 2000 to Year.Thank you so much,John

Hi John,

I've got some for ISO datetime string conversion at
http://bitbucket.org/japerk/elib/src/tip/src/datetime.erl
Does that help?

Jacob

On Jul 10, 7:49 am, "info"  < > wrote:
> Hi all,
>
> Given a date and a time according the following formats:
> Date = DDMMYY
> Time = HHMMSS
>
> Is it possible to build a composite string only by using the formats ?
> My problem is in the splitting ...
>
> Composite = YYYY-MM-DD HH:MM:SS
>
> John


More information about the erlang-questions mailing list