A common requirement in programs is getting the number of seconds, milliseconds, or nanoseconds since the Unix epoch. Here’s how to do it in Erlang.
To run the program:
In Erlang, we use erlang:system_time/1 to get the current system time in various units. The calendar:system_time_to_universal_time/1 and calendar:system_time_to_universal_time/2 functions are used to convert system time to datetime tuples.
Next, we’ll look at another time-related task: time parsing and formatting.