Skip to main content
Version: 4.0 (next)

Humanizer.ITimeSpanHumanizeStrategy

ITimeSpanHumanizeStrategy Interface​

Defines a strategy for converting System.TimeSpan values into human-readable text.

public interface ITimeSpanHumanizeStrategy

Derived
↳ DefaultTimeSpanHumanizeStrategy
↳ IGrammaticalCaseTimeSpanHumanizeStrategy

Methods​

ITimeSpanHumanizeStrategy.Humanize(TimeSpan, int, bool, CultureInfo, TimeUnit, TimeUnit, string, bool, bool) Method​

Converts a System.TimeSpan into human-readable text.

string Humanize(System.TimeSpan timeSpan, int precision, bool countEmptyUnits, System.Globalization.CultureInfo? culture, Humanizer.TimeUnit maxUnit, Humanizer.TimeUnit minUnit, string? collectionSeparator, bool toWords, bool toSymbols);
Parameters​

timeSpan System.TimeSpan

The time span to humanize.

precision System.Int32

The maximum number of time units to return.

countEmptyUnits System.Boolean

Whether empty time units count toward precision.

culture System.Globalization.CultureInfo

The culture to use. If null, the current culture is used.

maxUnit TimeUnit

The maximum unit of time to output.

minUnit TimeUnit

The minimum unit of time to output.

collectionSeparator System.String

The separator used to combine time parts. If null, the culture's default collection formatter is used.

toWords System.Boolean

Whether numbers are rendered as words.

toSymbols System.Boolean

Whether time units are rendered as symbols.

Returns​

System.String
The human-readable time span.