erlang生成日期如 "2015-03-05" 一般生成的是 "2015-3-5"/时间统计(与编程无关)/

erlang生成日期如 "2015-03-05" 一般生成的是 "2015-3-5"
一:
生成格式如:"2010-01-10"

datetime_utils:datetime_as_string({erlang:date(), undefined})

datetime_as_string({{Y, M, D} = _Date, undefined}) ->
lists:flatten(io_lib:format("4.10.0B-2.10.0B-~2.10.0B",
[Y, M, D]));

二:
string:right(integer_to_list(3), 3, $0).
"003"



there are 86400 seconds in a day
there are 365 days in an ordinary year
there are 366 days in a leap year
there are 1461 days in a 4 year period
there are 36524 days in a 100 year period
there are 146097 days in a 400 year period
there are 719528 days between Jan 1, 0 and Jan 1, 1970.

参考:
http://www.erlang.org/doc/man/calendar.html