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
relativeis a number or Date/Datetime representing the time distance fromnowor from options[:relative_to].backendis any module that includesuse Cldrand therefore is aCldrbackend module. The default isCldr.default_backend/0.optionsis aKeywordlist of options.
Options
:localeis the locale in which the binary is formatted. The default isCldr.get_locale/0:formatis the format of the binary. Format may be:default,:narrowor:short. The default is:default:unitis 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_tois the baseline Date or Datetime from which the difference fromrelativeis calculated whenrelativeis a Date or a DateTime. The default for a Date isDate.utc_today, for a DateTime it isDateTime.utc_now
See to_string/3