I have the following function that returns current date:
7> {Y,M,D}=erlang:date().
{2014,11,18}
Now I need to have a binary with these values inside like this:
<<"20141118">>
I have tried
15> S= [Y,M,D].
[2014,11,18]
16> list_to_binary(S).
** exception error: bad argument
in function list_to_binary/1
called as list_to_binary([2014,11,18])
You can do it like this:
Or like this, which is equivalent but not really practical for larger lists: