Cldr.DateTime.Formatter.fractional_second
You're seeing just the function
fractional_second, go back to Cldr.DateTime.Formatter module for more information.
Specs
fractional_second(Calendar.time(), integer(), Keyword.t()) :: String.t() | {:error, String.t()}
Returns the :second of a time or datetime (format symbol S) as float
in string format. The seconds are calculate to include microseconds if they
are available. The number of S's in the format determines the formatting.
Arguments
timeis aTimestruct or any map that contains at least the key:secondwith and optional:microsecondkey of the format used byTimenis the number of fractional digits to which the float number of seconds is roundedlocaleis any valid locale name returned byCldr.known_locale_names/0or aCldr.LanguageTagstruct. The default isCldr.get_locale/0optionsis aKeywordlist of options. There are no options used infractional_second/4
Format Symbol
The representation of the second is made in accordance with the following
table:
| Symbol | Results | Description |
|---|---|---|
| S | "4.0" | Minimim digits of fractional seconds |
| SS | "4.00" | Number of seconds zero-padded to 2 fractional digits |
| SSS | "4.002" | Number of seconds zero-padded to 3 fractional digits |
Examples
iex> Cldr.DateTime.Formatter.fractional_second %{second: 4, microsecond: {2000, 3}}, 1
"4.0"
iex> Cldr.DateTime.Formatter.fractional_second %{second: 4, microsecond: {2000, 3}}, 3
"4.002"
iex> Cldr.DateTime.Formatter.fractional_second %{second: 4}, 1
"4"
Specs
fractional_second( Calendar.time(), integer(), locale(), Cldr.backend(), Keyword.t() ) :: String.t() | {:error, String.t()}