# SecondsFormatterAPI (widget methods): World of Warcraft Forever API

Forever 1.60.1 (70959), Interface 16001, Lua 5.1, from Blizzard's own API documentation. Page: https://wowaddons.gg/forever-api/SecondsFormatterAPI

## Functions

### CanApproximate

```lua
canApproximate = self:CanApproximate(seconds)
```

Returns true if the given number of seconds is within an appropriate range for approximated formatting.

Arguments:
- `seconds`: Seconds

Returns:
- `canApproximate`: bool

### CanRoundUpIntervals

```lua
canRound = self:CanRoundUpIntervals()
```

Returns true if the formatter can promote values to higher interval bands.

Returns:
- `canRound`: bool

### CanRoundUpLastUnit

```lua
canRound = self:CanRoundUpLastUnit()
```

Returns true if the formatter should round the final unit up rather than down.

Returns:
- `canRound`: bool

### EvaluateDesiredUnitCount

```lua
count = self:EvaluateDesiredUnitCount(seconds)
```

Returns the unit count that a given number of seconds will use for formatting.

Arguments:
- `seconds`: Seconds

Returns:
- `count`: number

### EvaluateMaxInterval

```lua
interval = self:EvaluateMaxInterval(seconds)
```

Returns the maximum interval band that a given number of seconds will use for formatting.

Arguments:
- `seconds`: Seconds

Returns:
- `interval`: SecondsFormatterInterval

### EvaluateMinInterval

```lua
interval = self:EvaluateMinInterval(seconds)
```

Returns the minimum interval band that a given number of seconds will use for formatting.

Arguments:
- `seconds`: Seconds

Returns:
- `interval`: SecondsFormatterInterval

### Format

```lua
formattedSeconds = self:Format(seconds, [abbreviation])
```

Formats a number of seconds and returns the resulting string.

Arguments:
- `seconds`: Seconds
- `abbreviation`: SecondsFormatterAbbreviation, may be nil. Optional abbreviation mode to use in-place of the default.

Returns:
- `formattedSeconds`: string

### FormatZero

```lua
formattedSeconds = self:FormatZero([abbreviation])
```

Returns formatted string representing a zero second duration.

Arguments:
- `abbreviation`: SecondsFormatterAbbreviation, may be nil. Optional abbreviation mode to use in-place of the default.

Returns:
- `formattedSeconds`: string

### GetApproximationSeconds

```lua
approximationSeconds = self:GetApproximationSeconds()
```

Returns the threshold below which numeric values are formatted as approximated strings.

Returns:
- `approximationSeconds`: Seconds

### GetConvertToLower

```lua
convert = self:GetConvertToLower()
```

Returns true if the formatter should lowercase all unit format strings.

Returns:
- `convert`: bool

### GetDefaultAbbreviation

```lua
abbreviation = self:GetDefaultAbbreviation()
```

Returns the default abbreviation mode used for formatting.

Returns:
- `abbreviation`: SecondsFormatterAbbreviation, may be nil

### GetDesiredUnitCount

```lua
count = self:GetDesiredUnitCount()
```

Returns the desired unit count for formatting.

Returns:
- `count`: number, may be nil. Nil if configured to use a curve.

### GetDesiredUnitCountCurve

```lua
curve = self:GetDesiredUnitCountCurve()
```

Returns the desired unit count curve for formatting.

Returns:
- `curve`: LuaCurveObject, may be nil. Nil if configured to static unit count.

### GetMaxInterval

```lua
interval = self:GetMaxInterval()
```

Returns the maximum interval band permitted for formatting.

Returns:
- `interval`: SecondsFormatterInterval, may be nil. Nil if configured to use a curve.

### GetMaxIntervalCurve

```lua
curve = self:GetMaxIntervalCurve()
```

Returns the maximum interval band curve permitted for formatting.

Returns:
- `curve`: LuaCurveObject, may be nil. Nil if configured to static interval band.

### GetMillisecondsThreshold

```lua
threshold = self:GetMillisecondsThreshold()
```

Returns the threshold below which a value will be formatted as a decimal number of seconds with one place for milliseconds (eg. '3.4')

Returns:
- `threshold`: Seconds

### GetMinInterval

```lua
interval = self:GetMinInterval()
```

Returns the minimum interval band permitted for formatting.

Returns:
- `interval`: SecondsFormatterInterval, may be nil. Nil if configured to use a curve.

### GetMinIntervalCurve

```lua
curve = self:GetMinIntervalCurve()
```

Returns the minimum interval band curve permitted for formatting.

Returns:
- `curve`: LuaCurveObject, may be nil. Nil if configured to static interval band.

### GetRounding

```lua
rounding = self:GetRounding()
```

Returns how fractional seconds are rounded when not displaying milliseconds.

Returns:
- `rounding`: SecondsFormatterRounding. The configured rounding mode.

### GetStripIntervalWhitespace

```lua
strip = self:GetStripIntervalWhitespace()
```

Returns the whitespace stripping mode of the formatter.

Returns:
- `strip`: SecondsFormatterIntervalWhitespace

### Reset

```lua
self:Reset()
```

Resets all stored configuration of the formatter.

### SetApproximationSeconds

```lua
self:SetApproximationSeconds(seconds)
```

Configures the formatter to render numeric values between zero and this value as approximated strings (eg. '< 1m').

Arguments:
- `seconds`: Seconds

### SetCanRoundUpIntervals

```lua
self:SetCanRoundUpIntervals(canRound)
```

Configures the formatter to promote intervals if values are large enough (eg. '60m' -> '1h').

Arguments:
- `canRound`: bool

### SetCanRoundUpLastUnit

```lua
self:SetCanRoundUpLastUnit(canRound)
```

Configures the formatter to round the last formatted unit up, rather than down.

Arguments:
- `canRound`: bool

### SetConvertToLower

```lua
self:SetConvertToLower(convert)
```

Configures the formatter to convert all interval format strings to lowercase.

Arguments:
- `convert`: bool

### SetDefaultAbbreviation

```lua
self:SetDefaultAbbreviation(abbreviation)
```

Sets the default abbreviation mode used for formatting.

Arguments:
- `abbreviation`: SecondsFormatterAbbreviation

### SetDesiredUnitCount

```lua
self:SetDesiredUnitCount(count)
```

Sets the desired unit count used for formatting.

Arguments:
- `count`: number

### SetDesiredUnitCountCurve

```lua
self:SetDesiredUnitCountCurve(curve)
```

Sets the desired unit count used for formatting to a curve that will be evaluated with seconds values to produce a desired unit count.

Arguments:
- `curve`: LuaCurveObject

### SetMaxInterval

```lua
self:SetMaxInterval(interval)
```

Sets the maximum interval band used for formatting.

Arguments:
- `interval`: SecondsFormatterInterval

### SetMaxIntervalCurve

```lua
self:SetMaxIntervalCurve(curve)
```

Sets the maximum interval band used for formatting to a curve that will be evaluated with seconds values to produce a value matching a SecondsFormatterInterval enum member.

Arguments:
- `curve`: LuaCurveObject

### SetMillisecondsThreshold

```lua
self:SetMillisecondsThreshold(threshold)
```

Sets the threshold below which a value will be formatted as a decimal number of seconds with one place for milliseconds (eg. '3.4')

Arguments:
- `threshold`: Seconds

### SetMinInterval

```lua
self:SetMinInterval(interval)
```

Sets the minimum interval band used for formatting.

Arguments:
- `interval`: SecondsFormatterInterval

### SetMinIntervalCurve

```lua
self:SetMinIntervalCurve(curve)
```

Sets the minimum interval band used for formatting to a curve that will be evaluated with seconds values to produce a value matching a SecondsFormatterInterval enum member.

Arguments:
- `curve`: LuaCurveObject

### SetRounding

```lua
self:SetRounding(rounding)
```

Sets how fractional seconds are rounded when not displaying milliseconds.

Arguments:
- `rounding`: SecondsFormatterRounding. The rounding mode to use.

### SetStripIntervalWhitespace

```lua
self:SetStripIntervalWhitespace(strip)
```

Sets the whitespace stripping mode for the formatter.

Arguments:
- `strip`: SecondsFormatterIntervalWhitespace

---
Make an addon with your AI: tell it "Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it."
