NaiveDateTime.truncate
You're seeing just the function
truncate
, go back to NaiveDateTime module for more information.
Specs
Returns the given naive datetime with the microsecond field truncated to the
given precision (:microsecond
, :millisecond
or :second
).
The given naive datetime is returned unchanged if it already has lower precision than the given precision.
Examples
iex> NaiveDateTime.truncate(~N[2017-11-06 00:23:51.123456], :microsecond)
~N[2017-11-06 00:23:51.123456]
iex> NaiveDateTime.truncate(~N[2017-11-06 00:23:51.123456], :millisecond)
~N[2017-11-06 00:23:51.123]
iex> NaiveDateTime.truncate(~N[2017-11-06 00:23:51.123456], :second)
~N[2017-11-06 00:23:51]