[erlang-questions] How to format a local timestamp?
Sat Oct 3 00:25:36 CEST 2009
Sadly there isn't, but you might be able to cut and paste something
from one of these *11 different modules* that ship with Erlang:
$ find . -name "*.erl"|xargs grep '^month(12)'
./common_test-1.4.2/src/ct_logs.erl:month(12) -> "Dec".
./common_test-1.4.2/src/ct_master_logs.erl:month(12) -> "Dec".
./ic-4.2.21/src/ic_pp.erl:month(12) -> "Dec".
./inets-5.1/src/httpd_util.erl:month(12) -> "Dec".
./sasl-2.1.6/src/sasl_report.erl:month(12) -> "Dec".
./snmp-4.13.3/src/compiler/snmpc_mib_to_hrl.erl:month(12) -> "Dec".
./stdlib-1.16.2/src/c.erl:month(12) -> "December".
./stdlib-1.16.2/src/erl_tar.erl:month(12) -> "Dec".
./stdlib-1.16.2/src/error_logger_file_h.erl:month(12) -> "Dec".
./stdlib-1.16.2/src/error_logger_tty_h.erl:month(12) -> "Dec".
./stdlib-1.16.2/src/zip.erl:month(12) -> "Dec".
On Fri, Oct 2, 2009 at 3:05 PM, Cameron Kerr <> wrote:
> I must surely be missing something in the documentation, but I cannot find
> any easy way to generate a human-readable timestamp easily in Erlang.
> I would have expected something in the calendar module, but there is nothing
> that returns a string. I've hunted and I found something for RFC1123 format
> in httpd_util, but that is always in GMT, and I would much prefer something
> more familiar to the user (ie. localtime, with or without timezone).
> Surely there must be a standard function for doing something like this...
> until then, I'll just ~p calendar:local_time().
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
More information about the erlang-questions