I think your best bet is to use Paul Schoenfelder's (aka BitWalker) timex library for Elixir. The lib is here: https://github.com/bitwalker/timex and you can get the package from hex.pm https://hex.pm/packages/timex. Paul kindly provided a good explanation of how to use the library on the readme page of that github repo.
You could make calls to the native Erlang libs but I think Paul's lib is superior when one is dealing with Elixir.
To answer your question more specifically (though I really appreciate Onorio's recommendation to use Timex!), you can get the current date and time from the Erlang standard lib using :calendar.universal_time() or :calendar.local_time(). There are a number of useful functions for working with Erlang's datetime type in the calendar module, but they are somewhat limited, and don't provide you with anything for parsing or formatting dates, which is where Timex comes in.
You can also use :os.timestamp\0, which returns {megaseconds, seconds, microseconds} from UTC. :os.timestamp |> :calendar.now_to_datetime will give you now in erlang standard \{\{YYYY, MM, DD}, {HH, MM, SS}} format.
If you need to deal with Daylight Saving Time or time zones I made a library for that: Calendar.
To get the current time you would use for instance Calendar.DateTime.now("America/Los_Angeles") for the current time in Los Angeles or Calendar.DateTime.now_utc for the current time in UTC.
If you want Timezone details as well, use DateTime, which will also return things like timezone name, UTC offset, STD offset, and timezone abbreviation:
You can use any function in the Erlang standard library from Elixir. Traditionally, you would get the time with the now/0 function:
iex(1)> :erlang.now
{1487, 549978, 29683}
That represents time_t 1,487,549,978.29683, which is 19 minutes, 38.29683 seconds after midnight UTC on Monday, Feb 20, 2017.
However, since Erlang/OTP 18, that function is deprecated; one of the reasons is that Erlang guarantees that the return value will increase every call. If calling it in a tight loop on a machine fast enough to call it more than once per microsecond, the returned timestamp will get ahead of real time.
Since 1.3, Elixir has also had its own suite of modules for manipulating dates and times: Date and DateTime. You can use its functions to get the current date or time like so: