Standard Library Tour

hashing, ciphers, MACs, random bytes crypto:hash(sha256, <<"x">>), crypto:strong_rand_bytes(16) PKI, certificates, signatures JSON (OTP 27+) zip / erl_tar zip:create("a.zip", ["f.txt"])

calendar:local_time(), calendar:system_time_to_rfc3339(erlang:system_time(second))

erlang:monotonic_time(millisecond), erlang:system_time(second)

rand:uniform(100), rand:seed(exsss, {1,2,3}) httpc / httpd HTTP client/server (inets) ftp, tftp, ssh ssh:daemon(2222, Opts) snmp, diameter, megaco XML parsing/export query list comprehensions over ETS/Mnesia erl_scan / erl_parse / erl_eval tokenizing, parsing, evaluating Erlang compile at runtime CPU/memory/disk monitoring GUI toolkit (wxWidgets) used by observer command-line parsing (OTP 26+) escripts & CLIs start peer nodes (OTP 25+), great for tests peer:start_link(#{name => n1}) edlin, shell line editing, custom shells

41.1 Time handling

erlang:monotonic_time(),                           % for measuring durations
erlang:system_time(millisecond),                   % wall clock
erlang:convert_time_unit(T, native, microsecond),
calendar:universal_time(),                         % {{Y,M,D},{H,Mi,S}}
calendar:datetime_to_gregorian_seconds(DT),
calendar:day_of_the_week({2026, 10, 25}),
calendar:system_time_to_rfc3339(erlang:system_time(second), [{offset, "Z"}]),
calendar:rfc3339_to_system_time("2026-10-25T10:00:00Z"),
{Microseconds, Result} = timer:tc(fun() -> work() end).

41.2 argparse CLI (OTP 26+)

#!/usr/bin/env escript
main(Args) ->
    argparse:run(Args, #{
        arguments => [#{name => name, type => binary},
                      #{name => times, short => $n, long => "-times", type => integer, default => 1}],
        handler => fun(#{name := Name, times := N}) ->
                       [io:format("Hello, ~s~n", [Name]) || _ <- lists:seq(1, N)]
                   end}, #{progname => greet}).