DateTime.now-exclamation-mark

You're seeing just the function now-exclamation-mark, go back to DateTime module for more information.
Link to this function

now!(time_zone, time_zone_database \\ Calendar.get_time_zone_database())

View Source (since 1.10.0)

Specs

Returns the current datetime in the provided time zone or raises on errors

See now/2 for more information.

Examples

iex> datetime = DateTime.now!("Etc/UTC")
iex> datetime.time_zone
"Etc/UTC"

iex> DateTime.now!("Europe/Copenhagen")
** (ArgumentError) cannot get current datetime in "Europe/Copenhagen" time zone, reason: :utc_only_time_zone_database

iex> DateTime.now!("bad timezone", FakeTimeZoneDatabase)
** (ArgumentError) cannot get current datetime in "bad timezone" time zone, reason: :time_zone_not_found