Cldr.DateTime.Formatter.fractional_second

You're seeing just the function fractional_second, go back to Cldr.DateTime.Formatter module for more information.
Link to this function

fractional_second(fractional_second, n \\ 1, options \\ [])

View Source

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

Format Symbol

The representation of the second is made in accordance with the following table:

SymbolResultsDescription
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"
Link to this function

fractional_second(time, n, locale, backend, options \\ [])

View Source

Specs

fractional_second(
  Calendar.time(),
  integer(),
  locale(),
  Cldr.backend(),
  Keyword.t()
) :: String.t() | {:error, String.t()}