Cldr.DateTime.Relative.to_string-exclamation-mark
to_string-exclamation-mark
, go back to Cldr.DateTime.Relative module for more information.
to_string!(relative, backend \\ Cldr.Date.default_backend(), options \\ [])
View SourceSpecs
to_string!( integer() | float() | Date.t() | DateTime.t(), Cldr.backend(), Keyword.t() ) :: String.t()
Returns a {:ok, string}
representing a relative time (ago, in) for a given
number, Date or Datetime or raises an exception on error.
Arguments
relative
is a number or Date/Datetime representing the time distance fromnow
or from options[:relative_to].backend
is any module that includesuse Cldr
and therefore is aCldr
backend module. The default isCldr.default_backend/0
.options
is aKeyword
list of options.
Options
:locale
is the locale in which the binary is formatted. The default isCldr.get_locale/0
:format
is the format of the binary. Format may be:default
,:narrow
or:short
. The default is:default
:unit
is the time unit for the formatting. The allowable units are:second
,:minute
,:hour
,:day
,:week
,:month
,:year
,:mon
,:tue
,:wed
,:thu
,:fri
,:sat
,:sun
,:quarter
:relative_to
is the baseline Date or Datetime from which the difference fromrelative
is calculated whenrelative
is a Date or a DateTime. The default for a Date isDate.utc_today
, for a DateTime it isDateTime.utc_now
See to_string/3