Nostrum.Snowflake.from_datetime
You're seeing just the function
from_datetime
, go back to Nostrum.Snowflake module for more information.
Specs
from_datetime(DateTime.t()) :: {:ok, t()} | :error
Converts the given datetime
into a snowflake.
If datetime
occured before the discord epoch, the function will return
:error
.
The converted snowflake's last 22 bits will be zeroed out due to missing data.
Examples
iex> {:ok, dt, _} = DateTime.from_iso8601("2016-05-05T21:04:13.203Z")
iex> Nostrum.Snowflake.from_datetime(dt)
{:ok, 177888205536755712}
iex> {:ok, dt, _} = DateTime.from_iso8601("1998-12-25T00:00:00.000Z")
iex> Nostrum.Snowflake.from_datetime(dt)
:error