Unix Timestamps in Elixir
Unix timestamps are a very simple way to compare times in an integer format. They are the total seconds elapsed since January 1st, 1970 UTC (The Unix Epoch).
In elixir, if you want to do some operations on a DateTime
struct, and want to keep things simple, you can convert a DateTime
struct to an integer with to_unix/2
. By default, it will use seconds as the unit.